Check if a string has ANSI escape codes
$ npm install --save has-ansi
var hasAnsi = require('has-ansi'); hasAnsi('\u001b[4mcake\u001b[0m'); //=> true hasAnsi('cake'); //=> false
MIT © Sindre Sorhus