@ztimson/utils 0.26.8 → 0.26.10
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 +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +7 -2
- package/dist/index.mjs.map +1 -1
- package/dist/misc.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1731,6 +1731,10 @@ ${opts.message || this.desc}`;
|
|
|
1731
1731
|
if (ipv4 == "1") return "127.0.0.1";
|
|
1732
1732
|
return ipv4;
|
|
1733
1733
|
}
|
|
1734
|
+
function reservedIp(ip) {
|
|
1735
|
+
if (ip == "localhost") return true;
|
|
1736
|
+
return /\b(10\.(?:[0-9]{1,3}\.){2}[0-9]{1,3})\b|\b(172\.(?:1[6-9]|2[0-9]|3[0-1])\.(?:[0-9]{1,3}\.)[0-9]{1,3})\b|\b(192\.168\.(?:[0-9]{1,3}\.)[0-9]{1,3})\b/.test(ip);
|
|
1737
|
+
}
|
|
1734
1738
|
function PE(str, ...args) {
|
|
1735
1739
|
const combined = [];
|
|
1736
1740
|
for (let i = 0; i < str.length || i < args.length; i++) {
|
|
@@ -2048,9 +2052,9 @@ ${opts.message || this.desc}`;
|
|
|
2048
2052
|
case "!=":
|
|
2049
2053
|
return a != b;
|
|
2050
2054
|
case "+":
|
|
2051
|
-
return a.includes(b);
|
|
2055
|
+
return typeof (a == null ? void 0 : a.includes) != "undefined" ? a.includes(b) : a == b;
|
|
2052
2056
|
case "-":
|
|
2053
|
-
return !a.includes(b);
|
|
2057
|
+
return typeof (a == null ? void 0 : a.includes) != "undefined" ? !a.includes(b) : a != b;
|
|
2054
2058
|
case ">":
|
|
2055
2059
|
return a > b;
|
|
2056
2060
|
case ">=":
|
|
@@ -2335,6 +2339,7 @@ ${opts.message || this.desc}`;
|
|
|
2335
2339
|
exports2.randomHex = randomHex;
|
|
2336
2340
|
exports2.randomString = randomString;
|
|
2337
2341
|
exports2.randomStringBuilder = randomStringBuilder;
|
|
2342
|
+
exports2.reservedIp = reservedIp;
|
|
2338
2343
|
exports2.search = search;
|
|
2339
2344
|
exports2.sleep = sleep;
|
|
2340
2345
|
exports2.sleepWhile = sleepWhile;
|