add modules

This commit is contained in:
Shawn Napora
2019-08-08 10:10:17 -04:00
parent 90d84dbeeb
commit 660b172085
655 changed files with 115589 additions and 21 deletions

View File

@@ -0,0 +1,11 @@
const urlVariableRegex = /\{[^}]+\}/g;
function removeNonChars(variableName) {
return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
}
export function extractUrlVariableNames(url) {
const matches = url.match(urlVariableRegex);
if (!matches) {
return [];
}
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
}