.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / node_modules / slice-ansi / readme.md
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
3 > Slice a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
4
5
6 ## Install
7
8 ```
9 $ npm install slice-ansi
10 ```
11
12
13 ## Usage
14
15 ```js
16 const chalk = require('chalk');
17 const sliceAnsi = require('slice-ansi');
18
19 const input = 'The quick brown ' + chalk.red('fox jumped over ') +
20         'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
21
22 console.log(sliceAnsi(input, 20, 30));
23 ```
24
25
26 ## API
27
28 ### sliceAnsi(input, beginSlice, [endSlice])
29
30 #### input
31
32 Type: `string`
33
34 String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk).
35
36 #### beginSlice
37
38 Type: `number`
39
40 Zero-based index at which to begin the slice.
41
42 #### endSlice
43
44 Type: `number`
45
46 Zero-based index at which to end the slice.
47
48
49 ## Related
50
51 - [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
52 - [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal
53 - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
54
55
56 ## Maintainers
57
58 - [Sindre Sorhus](https://github.com/sindresorhus)
59 - [Josh Junon](https://github.com/qix-)
60
61
62 ## License
63
64 MIT