@ztimson/utils 0.27.13 → 0.27.14

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
@@ -1956,22 +1956,12 @@ class PathEvent {
1956
1956
  }
1957
1957
  let [p, method] = e.replaceAll(/\/{2,}/g, "/").split(":");
1958
1958
  if (!method) method = "*";
1959
- if (p === "" || p === void 0) {
1960
- this.module = "";
1961
- this.path = "";
1962
- this.fullPath = "";
1963
- this.name = "";
1964
- this.methods = new ASet(["n"]);
1965
- this.hasGlob = false;
1966
- PathEvent.pathEventCache.set(e, this);
1967
- return;
1968
- }
1969
- if (p === "*") {
1959
+ if (p === "" || p === void 0 || p === "*") {
1970
1960
  this.module = "";
1971
1961
  this.path = "";
1972
1962
  this.fullPath = "**";
1973
1963
  this.name = "";
1974
- this.methods = new ASet(["*"]);
1964
+ this.methods = new ASet(p === "*" ? ["*"] : method.split(""));
1975
1965
  this.hasGlob = true;
1976
1966
  PathEvent.pathEventCache.set(e, this);
1977
1967
  return;
@@ -2094,7 +2084,8 @@ class PathEvent {
2094
2084
  */
2095
2085
  static matches(pattern, target) {
2096
2086
  if (pattern.fullPath === "" || target.fullPath === "") return false;
2097
- if (pattern.fullPath === "*" || target.fullPath === "*") return pattern.methods.has("*") || target.methods.has("*") || pattern.methods.intersection(target.methods).length > 0;
2087
+ if (pattern.fullPath === "**") return pattern.methods.has("*") || pattern.methods.intersection(target.methods).length > 0;
2088
+ if (target.fullPath === "**") return pattern.methods.has("*") || target.methods.has("*") || pattern.methods.intersection(target.methods).length > 0;
2098
2089
  const methodsMatch = pattern.all || target.all || pattern.methods.intersection(target.methods).length > 0;
2099
2090
  if (!methodsMatch) return false;
2100
2091
  if (!pattern.hasGlob && !target.hasGlob) {