Get the `String#substr` correctly handling ansi escape codes.
npm install substr-ansi> Get the String#substr correctly handling ansi escape codes.
```
$ npm install --save substr-ansi
`js
var substrAnsi = require('substr-ansi');
console.log(substrAnsi('\u001b47mHi\u001b[49m', 0, 2));
//=> Hi
Note that the ansi code are preserved: \u001b[47mHi\u001b[49m
'\u001b[47mHi\u001b[49m'.substr(0, 2) results in a broken string:
//=> \u001b[
substrAnsi('\u001b[0m\u001b[31m\u001b[47mHello', 0, 5);
//=> Hello (visible text)
Complete string: \u001b[0m\u001b[31m\u001b[47mHello`
#### str
Required
Type: string
The original string that will be used to extract a section from it.
##### start
Type: integer 0
Default:
Location at which to begin extracting characters.
##### length
Type: integer str.length`
Default:
Optional. The number of characters to extract.
MIT © [Danilo Sampaio