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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Wrap words to a specified length.
  3. */
  4. export = wrap;
  5. declare function wrap(str: string, options?: wrap.IOptions): string;
  6. declare namespace wrap {
  7. export interface IOptions {
  8. /**
  9. * The width of the text before wrapping to a new line.
  10. * @default ´50´
  11. */
  12. width?: number;
  13. /**
  14. * The string to use at the beginning of each line.
  15. * @default ´ ´ (two spaces)
  16. */
  17. indent?: string;
  18. /**
  19. * The string to use at the end of each line.
  20. * @default ´\n´
  21. */
  22. newline?: string;
  23. /**
  24. * An escape function to run on each line after splitting them.
  25. * @default (str: string) => string;
  26. */
  27. escape?: (str: string) => string;
  28. /**
  29. * Trim trailing whitespace from the returned string.
  30. * This option is included since .trim() would also strip
  31. * the leading indentation from the first line.
  32. * @default true
  33. */
  34. trim?: boolean;
  35. /**
  36. * Break a word between any two letters when the word is longer
  37. * than the specified width.
  38. * @default false
  39. */
  40. cut?: boolean;
  41. }
  42. }