robert2206 8ad867f7a5 commit inicial | 8 years ago | |
---|---|---|
.. | ||
index.js | 8 years ago | |
license | 8 years ago | |
package.json | 8 years ago | |
readme.md | 8 years ago |
Slice a string with ANSI escape codes
$ npm install --save slice-ansi
var chalk = require('chalk');
var sliceAnsi = require('slice-ansi');
var input = 'The quick brown ' + chalk.red('fox jumped over ') +
'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
console.log(sliceAnsi(input, 20, 30));
Type: string
String with ANSI escape codes. Like one styled by chalk
.
Type: number
The zero-based index at which to begin the slice.
Type: number
Optional. The zero-based index at which to end the slice.
MIT © David Caccavella