frontend/.pnpm-store/v3/files/94/6ec332eda666f7382514068cfdc2f6e2a1c47d8c520211b80e86de6d7fedc560e485f992e2d5220304014c27f47e785422061008f4b180e24378bbc406cbb1

12 lines
360 B
Plaintext

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), []);
}