@ztimson/utils 0.25.16 → 0.25.18
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 +10 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +10 -3
- package/dist/index.mjs.map +1 -1
- package/dist/misc.d.ts +11 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1648,6 +1648,9 @@ ${opts.message || this.desc}`;
|
|
|
1648
1648
|
split = split.pop().split("/");
|
|
1649
1649
|
return whole + Number(split[0]) / Number(split[1]);
|
|
1650
1650
|
}
|
|
1651
|
+
function escapeRegex(value) {
|
|
1652
|
+
return value.replace(/[.*+?^${}()|\[\]\\]/g, "\\$&");
|
|
1653
|
+
}
|
|
1651
1654
|
function fn(args, fn2, async = false) {
|
|
1652
1655
|
const keys = Object.keys(args);
|
|
1653
1656
|
return new Function(...keys, `return (${async ? "async " : ""}(${keys.join(",")}) => { ${fn2} })(${keys.join(",")})`)(...keys.map((k) => args[k]));
|
|
@@ -1656,8 +1659,11 @@ ${opts.message || this.desc}`;
|
|
|
1656
1659
|
if (!email) return "";
|
|
1657
1660
|
return `https://www.gravatar.com/avatar/${md5(email)}?d=${def}`;
|
|
1658
1661
|
}
|
|
1659
|
-
function
|
|
1660
|
-
|
|
1662
|
+
function ipV6ToV4(ip) {
|
|
1663
|
+
if (!ip) return null;
|
|
1664
|
+
const ipv4 = ip.split(":").splice(-1)[0];
|
|
1665
|
+
if (ipv4 == "1") return "127.0.0.1";
|
|
1666
|
+
return ipv4;
|
|
1661
1667
|
}
|
|
1662
1668
|
function PE(str, ...args) {
|
|
1663
1669
|
const combined = [];
|
|
@@ -1792,7 +1798,7 @@ ${opts.message || this.desc}`;
|
|
|
1792
1798
|
const parsedTarget = makeArray(target).map((pe) => new PathEvent(pe));
|
|
1793
1799
|
const parsedRequired = makeArray(has).map((pe) => new PathEvent(pe));
|
|
1794
1800
|
return !!parsedRequired.find((r) => !!parsedTarget.find(
|
|
1795
|
-
(t) => (r.fullPath == "*" || t.fullPath == "*" || r.fullPath.startsWith(t.fullPath)
|
|
1801
|
+
(t) => (r.fullPath == "*" || t.fullPath == "*" || r.fullPath.startsWith(t.fullPath)) && (r.all || t.all || r.methods.intersection(t.methods).length)
|
|
1796
1802
|
));
|
|
1797
1803
|
}
|
|
1798
1804
|
/**
|
|
@@ -2181,6 +2187,7 @@ ${opts.message || this.desc}`;
|
|
|
2181
2187
|
exports2.includes = includes;
|
|
2182
2188
|
exports2.insertAt = insertAt;
|
|
2183
2189
|
exports2.instantInterval = instantInterval;
|
|
2190
|
+
exports2.ipV6ToV4 = ipV6ToV4;
|
|
2184
2191
|
exports2.isEqual = isEqual;
|
|
2185
2192
|
exports2.kebabCase = kebabCase;
|
|
2186
2193
|
exports2.logicTest = logicTest;
|