@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.mjs CHANGED
@@ -2024,8 +2024,8 @@ class PathEventEmitter {
2024
2024
  function search(rows, search2, regex, transform = (r) => r) {
2025
2025
  if (!rows) return [];
2026
2026
  return rows.filter((r) => {
2027
- const value = transform(r);
2028
2027
  if (!search2) return true;
2028
+ const value = transform(r);
2029
2029
  if (regex) {
2030
2030
  return !!Object.values(value).filter((v) => {
2031
2031
  try {
@@ -2035,7 +2035,7 @@ function search(rows, search2, regex, transform = (r) => r) {
2035
2035
  }
2036
2036
  }).length;
2037
2037
  } else {
2038
- return logicTest(r, search2);
2038
+ return logicTest(value, search2);
2039
2039
  }
2040
2040
  });
2041
2041
  }
@@ -2047,9 +2047,9 @@ function logicTest(target, condition) {
2047
2047
  return a == b;
2048
2048
  case "!=":
2049
2049
  return a != b;
2050
- case "+":
2050
+ case "+=":
2051
2051
  return a == null ? void 0 : a.toString().includes(b);
2052
- case "-":
2052
+ case "-=":
2053
2053
  return !(a == null ? void 0 : a.toString().includes(b));
2054
2054
  case ">":
2055
2055
  return a > b;
@@ -2067,7 +2067,7 @@ function logicTest(target, condition) {
2067
2067
  return -1 != or.findIndex((p) => {
2068
2068
  const and = p.split("&&").map((p2) => p2.trim()).filter((p2) => !!p2);
2069
2069
  return and.filter((p2) => {
2070
- const prop = /(\S+)\s*(==?|!=|\+|-|>=|>|<=|<)\s*(\S+)/g.exec(p2);
2070
+ const prop = /(\S+)\s*(==?|!=|\+=|-=|>=|>|<=|<)\s*(\S+)/g.exec(p2);
2071
2071
  if (prop) {
2072
2072
  const key = Object.keys(target).find((k) => k.toLowerCase() == prop[1].toLowerCase());
2073
2073
  return evalBoolean(dotNotation(target, key || prop[1]), prop[2], JSONAttemptParse(prop[3]));