From b476046268f3365646497aaf18b664d6a7be261d Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 28 Jul 2022 02:04:20 +0300 Subject: [PATCH] fixup! reuse stringAsRegExp --- background/uso-api.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/background/uso-api.js b/background/uso-api.js index d21e1107..45688d6d 100644 --- a/background/uso-api.js +++ b/background/uso-api.js @@ -1,3 +1,4 @@ +/* global stringAsRegExp */// toolbox.js /* global usercssMan */ 'use strict'; @@ -96,10 +97,7 @@ const usoApi = { } function useNewKeys(css) { - const rxsKeys = Object.keys(badKeys) - .join('\n') - .replace(/[{}()[\]\\.+*?^$|]/g, '\\$&') - .replace(/\n/g, '|'); + const rxsKeys = stringAsRegExp(Object.keys(badKeys).join('\n'), '', true).replace(/\n/g, '|'); const rxUsoVars = new RegExp(`(/\\*\\[\\[)(${rxsKeys})(?=]]\\*/)`, 'g'); return css.replace(rxUsoVars, (s, a, key) => a + badKeys[key]); }