From 65be937e72dc52c383bf846b74b3079a0be7ec04 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Tue, 2 Oct 2018 14:53:00 +0300 Subject: [PATCH] Update index.js --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 917c45f..404d8f0 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,4 @@ 'use strict'; -const escapeStringRegexp = require('escape-string-regexp'); const ansiStyles = require('ansi-styles'); const stdoutColor = require('supports-color').stdout; @@ -15,6 +14,10 @@ const skipModels = new Set(['gray']); const styles = Object.create(null); +function escapeStringRegexp(str) { + return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} + function applyOptions(obj, options = {}) { if (options.level > 3 || options.level < 0) { throw new Error('The `level` option should be an integer from 0 to 3');