@ztimson/utils 0.26.7 → 0.26.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2043,6 +2043,10 @@ function logicTest(target, condition) {
|
|
|
2043
2043
|
return a == b;
|
|
2044
2044
|
case "!=":
|
|
2045
2045
|
return a != b;
|
|
2046
|
+
case "+":
|
|
2047
|
+
return a.includes(b);
|
|
2048
|
+
case "-":
|
|
2049
|
+
return !a.includes(b);
|
|
2046
2050
|
case ">":
|
|
2047
2051
|
return a > b;
|
|
2048
2052
|
case ">=":
|
|
@@ -2059,7 +2063,7 @@ function logicTest(target, condition) {
|
|
|
2059
2063
|
return -1 != or.findIndex((p) => {
|
|
2060
2064
|
const and = p.split("&&").map((p2) => p2.trim()).filter((p2) => !!p2);
|
|
2061
2065
|
return and.filter((p2) => {
|
|
2062
|
-
const prop = /(\S+)\s*(
|
|
2066
|
+
const prop = /(\S+)\s*(==?|!=|\+|-|>=|>|<=|<)\s*(\S+)/g.exec(p2);
|
|
2063
2067
|
if (prop) {
|
|
2064
2068
|
const key = Object.keys(target).find((k) => k.toLowerCase() == prop[1].toLowerCase());
|
|
2065
2069
|
return evalBoolean(dotNotation(target, key || prop[1]), prop[2], JSONAttemptParse(prop[3]));
|