@ztimson/utils 0.26.14 → 0.26.16

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
@@ -1525,7 +1525,7 @@ const _Http = class _Http {
1525
1525
  if (!this.url && !opts.url) throw new Error("URL needs to be set");
1526
1526
  let url = ((_a = opts.url) == null ? void 0 : _a.startsWith("http")) ? opts.url : (this.url || "") + (opts.url || "");
1527
1527
  url = url.replaceAll(/([^:]\/)\/+/g, "$1");
1528
- if (opts.fragment) url.includes("#") ? url.replace(/#.*(\?|\n)/g, (match, arg1) => `#${opts.fragment}${arg1}`) : `${url}#${opts.fragment}`;
1528
+ if (opts.fragment) url.includes("#") ? url.replace(/#.*([?\n])/g, (match, arg1) => `#${opts.fragment}${arg1}`) : `${url}#${opts.fragment}`;
1529
1529
  if (opts.query) {
1530
1530
  const q = Array.isArray(opts.query) ? opts.query : Object.keys(opts.query).map((k) => ({ key: k, value: opts.query[k] }));
1531
1531
  url += (url.includes("?") ? "&" : "?") + q.map((q2) => `${q2.key}=${q2.value}`).join("&");
@@ -2024,8 +2024,8 @@ class PathEventEmitter {
2024
2024
  function search(rows, search2, regex, transform = (r) => r) {
2025
2025
  if (!rows) return [];
2026
2026
  return rows.filter((r) => {
2027
- const value = transform(r);
2028
2027
  if (!search2) return true;
2028
+ const value = transform(r);
2029
2029
  if (regex) {
2030
2030
  return !!Object.values(value).filter((v) => {
2031
2031
  try {
@@ -2035,7 +2035,7 @@ function search(rows, search2, regex, transform = (r) => r) {
2035
2035
  }
2036
2036
  }).length;
2037
2037
  } else {
2038
- return logicTest(r, search2);
2038
+ return logicTest(value, search2);
2039
2039
  }
2040
2040
  });
2041
2041
  }