lgoad-upload-action/node_modules/@octokit/endpoint/dist-src/util/extract-url-variable-names.js

15 lines
377 B
JavaScript
Raw Normal View History

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