mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-23 16:17:46 +00:00
12 lines
No EOL
403 B
JavaScript
12 lines
No EOL
403 B
JavaScript
module.exports = (routeConfig, path) => {
|
|
const matches = path.match(routeConfig.regexp);
|
|
return routeConfig.urlParamsNames.reduce((urlParams, name, index) => {
|
|
if (Array.isArray(matches) && typeof matches[index + 1] === 'string') {
|
|
urlParams[name] = matches[index + 1];
|
|
} else {
|
|
urlParams[name] = null;
|
|
}
|
|
|
|
return urlParams;
|
|
}, {});
|
|
}; |