From 65be937e72dc52c383bf846b74b3079a0be7ec04 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Tue, 2 Oct 2018 14:53:00 +0300 Subject: [PATCH 1/3] 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'); From 07735a5c9d8646f23a42e915d6127c362c4a5f2f Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Tue, 2 Oct 2018 14:53:29 +0300 Subject: [PATCH 2/3] Remove dependency on escape-string-regexp --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 32c6f73..99e57f7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ ], "dependencies": { "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", "supports-color": "^5.5.0" }, "devDependencies": { From c67ebe4285fdbf3d463a897cd5add982cc56cb18 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Tue, 2 Oct 2018 14:59:11 +0300 Subject: [PATCH 3/3] Fixed indentation --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 404d8f0..4c10b8b 100644 --- a/index.js +++ b/index.js @@ -15,7 +15,7 @@ const skipModels = new Set(['gray']); const styles = Object.create(null); function escapeStringRegexp(str) { - return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); } function applyOptions(obj, options = {}) {