Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public componentDidUpdate(prevProps: IProps) {
const text = matchPath(
this.props.location.pathname, routes["/library/search/text"],
).params.value;
const prevText = matchPath(
prevProps.location.pathname, routes["/library/search/text"],
).params.value;
if (text !== prevText) {
// Refresh searched pubs
this.searchPublications();
}
}
config.appData.routes.some(route => {
const match = matchPath(req.url, route);
if (match) {
selectedRoutes.push(route);
}
return match;
});
const isActive = (path, history) => {
return matchPath(path, {
path: history.location.pathname,
exact: true,
strict: false
})
}
className={(() => {
const navPath = nav.path;
const isMatchRoute = matchPath(pathname, {
path: navPath,
});
if (pathname === '/') {
return pathname === navPath ? navClassName : '';
} else {
return isMatchRoute && navPath !== '/' ? navClassName : '';
}
})()}
>
const matches = (p: string) => {
return Boolean(matchPath(p, { path: this.props.location.pathname }));
};
function getKey({ pathname }, path, exact) {
return matchPath(pathname, { exact, path }) ? 'match' : 'no-match';
}
hideAppHeader () {
const { location } = this.props
const isInitializing = Boolean(matchPath(location.pathname, {
path: INITIALIZE_ROUTE, exact: false,
}))
if (isInitializing && !this.onInitializationUnlockPage()) {
return true
}
if (window.METAMASK_UI_TYPE === ENVIRONMENT_TYPE_NOTIFICATION) {
return true
}
if (window.METAMASK_UI_TYPE === ENVIRONMENT_TYPE_POPUP) {
return this.onConfirmPage() || this.hasProviderRequests()
}
}
routes.some(route => {
const match = matchPath(req.path, route);
if (match) promises.push(store.dispatch(route.loadData()));
return match;
});
const route = routes.find(routeToMatch => matchPath(nonRawPath, routeToMatch));