您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. export type Options = {
  2. /**
  3. By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width.
  4. @default false
  5. */
  6. readonly hard?: boolean;
  7. /**
  8. By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary.
  9. @default true
  10. */
  11. readonly wordWrap?: boolean;
  12. /**
  13. Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim.
  14. @default true
  15. */
  16. readonly trim?: boolean;
  17. };
  18. /**
  19. Wrap words to the specified column width.
  20. @param string - String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk). Newline characters will be normalized to `\n`.
  21. @param columns - Number of columns to wrap the text to.
  22. @example
  23. ```
  24. import chalk from 'chalk';
  25. import wrapAnsi from 'wrap-ansi';
  26. const input = 'The quick brown ' + chalk.red('fox jumped over ') +
  27. 'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
  28. console.log(wrapAnsi(input, 20));
  29. ```
  30. */
  31. export default function wrapAnsi(string: string, columns: number, options?: Options): string;