feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -9,16 +9,14 @@
* @param {string} str string
* @returns {string} quoted meta
*/
const quoteMeta = str => {
return str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
};
const quoteMeta = str => str.replace(/[-[\]\\/{}()*+?.^$|]/g, "\\$&");
/**
* @param {string} str string
* @returns {string} string
*/
const toSimpleString = str => {
if (`${+str}` === str) {
if (`${Number(str)}` === str) {
return str;
}
return JSON.stringify(str);
@@ -52,9 +50,8 @@ const compileBooleanMatcherFromLists = (positiveItems, negativeItems) => {
const negativeRegexp = itemsToRegexp(negativeItems);
if (positiveRegexp.length <= negativeRegexp.length) {
return value => `/^${positiveRegexp}$/.test(${value})`;
} else {
return value => `!/^${negativeRegexp}$/.test(${value})`;
}
return value => `!/^${negativeRegexp}$/.test(${value})`;
};
/**