@ztimson/utils 0.26.13 → 0.26.15
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 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2028,8 +2028,8 @@ ${opts.message || this.desc}`;
|
|
|
2028
2028
|
function search(rows, search2, regex, transform = (r) => r) {
|
|
2029
2029
|
if (!rows) return [];
|
|
2030
2030
|
return rows.filter((r) => {
|
|
2031
|
-
const value = transform(r);
|
|
2032
2031
|
if (!search2) return true;
|
|
2032
|
+
const value = transform(r);
|
|
2033
2033
|
if (regex) {
|
|
2034
2034
|
return !!Object.values(value).filter((v) => {
|
|
2035
2035
|
try {
|
|
@@ -2039,7 +2039,7 @@ ${opts.message || this.desc}`;
|
|
|
2039
2039
|
}
|
|
2040
2040
|
}).length;
|
|
2041
2041
|
} else {
|
|
2042
|
-
return logicTest(
|
|
2042
|
+
return logicTest(value, search2);
|
|
2043
2043
|
}
|
|
2044
2044
|
});
|
|
2045
2045
|
}
|
|
@@ -2051,9 +2051,9 @@ ${opts.message || this.desc}`;
|
|
|
2051
2051
|
return a == b;
|
|
2052
2052
|
case "!=":
|
|
2053
2053
|
return a != b;
|
|
2054
|
-
case "
|
|
2054
|
+
case "+=":
|
|
2055
2055
|
return a == null ? void 0 : a.toString().includes(b);
|
|
2056
|
-
case "
|
|
2056
|
+
case "-=":
|
|
2057
2057
|
return !(a == null ? void 0 : a.toString().includes(b));
|
|
2058
2058
|
case ">":
|
|
2059
2059
|
return a > b;
|
|
@@ -2071,7 +2071,7 @@ ${opts.message || this.desc}`;
|
|
|
2071
2071
|
return -1 != or.findIndex((p) => {
|
|
2072
2072
|
const and = p.split("&&").map((p2) => p2.trim()).filter((p2) => !!p2);
|
|
2073
2073
|
return and.filter((p2) => {
|
|
2074
|
-
const prop = /(\S+)\s*(
|
|
2074
|
+
const prop = /(\S+)\s*(==?|!=|\+=|-=|>=|>|<=|<)\s*(\S+)/g.exec(p2);
|
|
2075
2075
|
if (prop) {
|
|
2076
2076
|
const key = Object.keys(target).find((k) => k.toLowerCase() == prop[1].toLowerCase());
|
|
2077
2077
|
return evalBoolean(dotNotation(target, key || prop[1]), prop[2], JSONAttemptParse(prop[3]));
|