@ztimson/utils 0.26.6 → 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.mjs CHANGED
@@ -479,7 +479,9 @@ class Cache {
479
479
  if (((_a = persists.storage) == null ? void 0 : _a.database) != void 0) {
480
480
  persists.storage.createTable({ name: persists.key, key: this.key }).then((table) => {
481
481
  if (key) {
482
- table.set(this.get(key), key);
482
+ const value = this.get(key);
483
+ if (value != null) table.set(value, key);
484
+ else table.delete(key);
483
485
  } else {
484
486
  table.clear();
485
487
  this.all().forEach((row) => table.add(row));
@@ -2041,6 +2043,10 @@ function logicTest(target, condition) {
2041
2043
  return a == b;
2042
2044
  case "!=":
2043
2045
  return a != b;
2046
+ case "+":
2047
+ return a.includes(b);
2048
+ case "-":
2049
+ return !a.includes(b);
2044
2050
  case ">":
2045
2051
  return a > b;
2046
2052
  case ">=":
@@ -2057,7 +2063,7 @@ function logicTest(target, condition) {
2057
2063
  return -1 != or.findIndex((p) => {
2058
2064
  const and = p.split("&&").map((p2) => p2.trim()).filter((p2) => !!p2);
2059
2065
  return and.filter((p2) => {
2060
- const prop = /(\S+)\s*(==?|!=|>=|>|<=|<)\s*(\S+)/g.exec(p2);
2066
+ const prop = /(\S+)\s*(==?|!=|\+|-|>=|>|<=|<)\s*(\S+)/g.exec(p2);
2061
2067
  if (prop) {
2062
2068
  const key = Object.keys(target).find((k) => k.toLowerCase() == prop[1].toLowerCase());
2063
2069
  return evalBoolean(dotNotation(target, key || prop[1]), prop[2], JSONAttemptParse(prop[3]));