web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.2 KiB

  1. # indent-string [![Build Status](https://travis-ci.org/sindresorhus/indent-string.svg?branch=master)](https://travis-ci.org/sindresorhus/indent-string)
  2. > Indent each line in a string
  3. ## Install
  4. ```
  5. $ npm install indent-string
  6. ```
  7. ## Usage
  8. ```js
  9. const indentString = require('indent-string');
  10. indentString('Unicorns\nRainbows', 4);
  11. //=> ' Unicorns\n Rainbows'
  12. indentString('Unicorns\nRainbows', 4, {indent: '♥'});
  13. //=> '♥♥♥♥Unicorns\n♥♥♥♥Rainbows'
  14. ```
  15. ## API
  16. ### indentString(string, [count], [options])
  17. #### string
  18. Type: `string`
  19. The string to indent.
  20. #### count
  21. Type: `number`<br>
  22. Default: `1`
  23. How many times you want `options.indent` repeated.
  24. #### options
  25. Type: `object`
  26. ##### indent
  27. Type: `string`<br>
  28. Default: `' '`
  29. The string to use for the indent.
  30. ##### includeEmptyLines
  31. Type: `boolean`<br>
  32. Default: `false`
  33. Also indent empty lines.
  34. ## Related
  35. - [indent-string-cli](https://github.com/sindresorhus/indent-string-cli) - CLI for this module
  36. - [strip-indent](https://github.com/sindresorhus/strip-indent) - Strip leading whitespace from every line in a string
  37. ## License
  38. MIT © [Sindre Sorhus](https://sindresorhus.com)