index.d.ts 783 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. declare namespace indentString {
  2. interface Options {
  3. /**
  4. The string to use for the indent.
  5. @default ' '
  6. */
  7. readonly indent?: string;
  8. /**
  9. Also indent empty lines.
  10. @default false
  11. */
  12. readonly includeEmptyLines?: boolean;
  13. }
  14. }
  15. /**
  16. Indent each line in a string.
  17. @param string - The string to indent.
  18. @param count - How many times you want `options.indent` repeated. Default: `1`.
  19. @example
  20. ```
  21. import indentString = require('indent-string');
  22. indentString('Unicorns\nRainbows', 4);
  23. //=> ' Unicorns\n Rainbows'
  24. indentString('Unicorns\nRainbows', 4, {indent: '♥'});
  25. //=> '♥♥♥♥Unicorns\n♥♥♥♥Rainbows'
  26. ```
  27. */
  28. declare function indentString(
  29. string: string,
  30. count?: number,
  31. options?: indentString.Options
  32. ): string;
  33. export = indentString;