fixup! reuse stringAsRegExp
This commit is contained in:
parent
8ca1e3ba70
commit
b476046268
|
@ -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]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user