MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / getRouteAuthority

Function getRouteAuthority

src/utils/utils.js:26–45  ·  view source on GitHub ↗
(path, routeData)

Source from the content-addressed store, hash-verified

24 return undefined;
25};
26export const getRouteAuthority = (path, routeData) => {
27 let authorities;
28 routeData.forEach(route => {
29 // match prefix
30 if (pathRegexp(`${route.path}/(.*)`).test(`${path}/`)) {
31 if (route.authority) {
32 authorities = route.authority;
33 } // exact match
34
35 if (route.path === path) {
36 authorities = route.authority || authorities;
37 } // get children authority recursively
38
39 if (route.routes) {
40 authorities = getRouteAuthority(path, route.routes) || authorities;
41 }
42 }
43 });
44 return authorities;
45};
46
47/**
48 * 替换当前地址中的REQUEST_IP 通配符

Callers 2

utils.test.jsFile · 0.90
AuthComponentFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected