Files
planka/client/src/utils/match-paths.js

20 lines
310 B
JavaScript
Raw Normal View History

2019-08-31 04:07:25 +05:00
import { matchPath } from 'react-router-dom';
export default (pathname, paths) => {
for (let i = 0; i < paths.length; i += 1) {
2022-11-21 00:54:05 +01:00
const match = matchPath(
{
path: paths[i],
end: true,
},
pathname,
);
2019-08-31 04:07:25 +05:00
if (match) {
return match;
}
}
return null;
};