UNPKG

ignite-cli

Version:

Infinite Red's hottest boilerplate for React Native.

23 lines 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stripANSI = void 0; // https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js function ansiRegex(_a) { var _b = _a === void 0 ? {} : _a, _c = _b.onlyFirst, onlyFirst = _c === void 0 ? false : _c; var pattern = [ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))", ].join("|"); return new RegExp(pattern, onlyFirst ? undefined : "g"); } function stripANSI(string) { if (typeof string !== "string") { throw new TypeError("Expected a `string`, got `".concat(typeof string, "`")); } // Even though the regex is global, we don't need to reset the `.lastIndex` // because unlike `.exec()` and `.test()`, `.replace()` does it automatically // and doing it manually has a performance penalty. return string.replace(ansiRegex(), ""); } exports.stripANSI = stripANSI; //# sourceMappingURL=strip-ansi.js.map