José Quiñones Flores 4564da0130 Added Laravel project and removed sensitive data | пре 4 година | |
---|---|---|
.. | ||
index.js | пре 4 година | |
package.json | пре 4 година | |
readme.md | пре 4 година |
Regular expression for matching ANSI escape codes
$ npm install --save ansi-regex
var ansiRegex = require('ansi-regex');
ansiRegex().test('\u001b[4mcake\u001b[0m');
//=> true
ansiRegex().test('cake');
//=> false
'\u001b[4mcake\u001b[0m'.match(ansiRegex());
//=> ['\u001b[4m', '\u001b[0m']
It’s a function so you can create multiple instances. Regexes with the global flag will have the .lastIndex
property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for .test()
.
MIT © Sindre Sorhus