@ztimson/utils 0.25.17 → 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 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 escapeRegex(value) {
1660
- return value.replace(/[.*+?^${}()|\[\]\\]/g, "\\$&");
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 = [];
@@ -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;