@ztimson/utils 0.24.2 → 0.24.3
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 +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/index.mjs.map +1 -1
- package/dist/search.d.ts +7 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1439,7 +1439,7 @@ function PE(str, ...args) {
|
|
|
1439
1439
|
if (str[i]) combined.push(str[i]);
|
|
1440
1440
|
if (args[i]) combined.push(args[i]);
|
|
1441
1441
|
}
|
|
1442
|
-
return new PathEvent(combined.join(""));
|
|
1442
|
+
return new PathEvent(combined.join("/"));
|
|
1443
1443
|
}
|
|
1444
1444
|
function PES(str, ...args) {
|
|
1445
1445
|
let combined = [];
|
|
@@ -1498,28 +1498,28 @@ class PathEvent {
|
|
|
1498
1498
|
return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("c"));
|
|
1499
1499
|
}
|
|
1500
1500
|
set create(v) {
|
|
1501
|
-
v ? this.methods.delete("n").add("c") : this.methods.delete("c");
|
|
1501
|
+
v ? this.methods.delete("n").delete("*").add("c") : this.methods.delete("c");
|
|
1502
1502
|
}
|
|
1503
1503
|
/** Read method specified */
|
|
1504
1504
|
get read() {
|
|
1505
1505
|
return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("r"));
|
|
1506
1506
|
}
|
|
1507
1507
|
set read(v) {
|
|
1508
|
-
v ? this.methods.delete("n").add("r") : this.methods.delete("r");
|
|
1508
|
+
v ? this.methods.delete("n").delete("*").add("r") : this.methods.delete("r");
|
|
1509
1509
|
}
|
|
1510
1510
|
/** Update method specified */
|
|
1511
1511
|
get update() {
|
|
1512
1512
|
return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("u"));
|
|
1513
1513
|
}
|
|
1514
1514
|
set update(v) {
|
|
1515
|
-
v ? this.methods.delete("n").add("u") : this.methods.delete("u");
|
|
1515
|
+
v ? this.methods.delete("n").delete("*").add("u") : this.methods.delete("u");
|
|
1516
1516
|
}
|
|
1517
1517
|
/** Delete method specified */
|
|
1518
1518
|
get delete() {
|
|
1519
1519
|
return !this.methods.has("n") && (this.methods.has("*") || this.methods.has("d"));
|
|
1520
1520
|
}
|
|
1521
1521
|
set delete(v) {
|
|
1522
|
-
v ? this.methods.delete("n").add("d") : this.methods.delete("d");
|
|
1522
|
+
v ? this.methods.delete("n").delete("*").add("d") : this.methods.delete("d");
|
|
1523
1523
|
}
|
|
1524
1524
|
/**
|
|
1525
1525
|
* Combine multiple events into one parsed object. Longest path takes precedent, but all subsequent methods are
|
|
@@ -1677,11 +1677,11 @@ function search(rows, search2, regex, transform = (r) => r) {
|
|
|
1677
1677
|
}
|
|
1678
1678
|
}).length;
|
|
1679
1679
|
} else {
|
|
1680
|
-
return
|
|
1680
|
+
return logicTest(r, search2);
|
|
1681
1681
|
}
|
|
1682
1682
|
});
|
|
1683
1683
|
}
|
|
1684
|
-
function
|
|
1684
|
+
function logicTest(target, condition) {
|
|
1685
1685
|
const evalBoolean = (a, op, b) => {
|
|
1686
1686
|
switch (op) {
|
|
1687
1687
|
case "=":
|
|
@@ -1707,10 +1707,10 @@ function testCondition(condition, row) {
|
|
|
1707
1707
|
return and.filter((p2) => {
|
|
1708
1708
|
const prop = /(\S+)\s*(==?|!=|>=|>|<=|<)\s*(\S+)/g.exec(p2);
|
|
1709
1709
|
if (prop) {
|
|
1710
|
-
const key = Object.keys(
|
|
1711
|
-
return evalBoolean(dotNotation(
|
|
1710
|
+
const key = Object.keys(target).find((k) => k.toLowerCase() == prop[1].toLowerCase());
|
|
1711
|
+
return evalBoolean(dotNotation(target, key || prop[1]), prop[2], JSONAttemptParse(prop[3]));
|
|
1712
1712
|
}
|
|
1713
|
-
const v = Object.values(
|
|
1713
|
+
const v = Object.values(target).map(JSONSerialize).join("");
|
|
1714
1714
|
if (/[A-Z]/g.test(condition)) return v.includes(p2);
|
|
1715
1715
|
return v.toLowerCase().includes(p2);
|
|
1716
1716
|
}).length == and.length;
|
|
@@ -1791,6 +1791,7 @@ export {
|
|
|
1791
1791
|
instantInterval,
|
|
1792
1792
|
isEqual,
|
|
1793
1793
|
kebabCase,
|
|
1794
|
+
logicTest,
|
|
1794
1795
|
makeArray,
|
|
1795
1796
|
makeUnique,
|
|
1796
1797
|
matchAll,
|
|
@@ -1808,7 +1809,6 @@ export {
|
|
|
1808
1809
|
snakeCase,
|
|
1809
1810
|
sortByProp,
|
|
1810
1811
|
strSplice,
|
|
1811
|
-
testCondition,
|
|
1812
1812
|
timeUntil,
|
|
1813
1813
|
timestampFilename,
|
|
1814
1814
|
toCsv,
|