@next-core/brick-utils 2.41.2 → 2.42.0

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.esm.js CHANGED
@@ -21634,7 +21634,9 @@ function matchPath(pathname, options) {
21634
21634
  path: p,
21635
21635
  exact = false,
21636
21636
  strict = false,
21637
- sensitive = true
21637
+ sensitive = true,
21638
+ checkIf,
21639
+ getContext
21638
21640
  } = options;
21639
21641
  var paths = Array.isArray(p) ? p : [p];
21640
21642
  return paths.reduce((matched, path) => {
@@ -21664,7 +21666,7 @@ function matchPath(pathname, options) {
21664
21666
  }
21665
21667
 
21666
21668
  var initialParams = {};
21667
- return {
21669
+ var result = {
21668
21670
  path,
21669
21671
  // the path used to match
21670
21672
  url: path === "/" && url === "" ? "/" : url,
@@ -21676,6 +21678,12 @@ function matchPath(pathname, options) {
21676
21678
  return memo;
21677
21679
  }, initialParams)
21678
21680
  };
21681
+
21682
+ if (checkIf && !checkIf(getContext(result))) {
21683
+ return null;
21684
+ }
21685
+
21686
+ return result;
21679
21687
  }, null);
21680
21688
  }
21681
21689
  function toPath(path, pathParams) {