Ohm-Management - Projektarbeit B-ME
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.

readme.md 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # slice-ansi [![Build Status](https://travis-ci.org/chalk/slice-ansi.svg?branch=master)](https://travis-ci.org/chalk/slice-ansi) [![XO: Linted](https://img.shields.io/badge/xo-linted-blue.svg)](https://github.com/sindresorhus/xo)
  2. > Slice a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
  3. ## Install
  4. ```
  5. $ npm install slice-ansi
  6. ```
  7. ## Usage
  8. ```js
  9. const chalk = require('chalk');
  10. const sliceAnsi = require('slice-ansi');
  11. const input = 'The quick brown ' + chalk.red('fox jumped over ') +
  12. 'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
  13. console.log(sliceAnsi(input, 20, 30));
  14. ```
  15. ## API
  16. ### sliceAnsi(input, beginSlice, [endSlice])
  17. #### input
  18. Type: `string`
  19. String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk).
  20. #### beginSlice
  21. Type: `number`
  22. Zero-based index at which to begin the slice.
  23. #### endSlice
  24. Type: `number`
  25. Zero-based index at which to end the slice.
  26. ## Related
  27. - [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
  28. - [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal
  29. - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
  30. ## Maintainers
  31. - [Sindre Sorhus](https://github.com/sindresorhus)
  32. - [Josh Junon](https://github.com/qix-)
  33. ## License
  34. MIT