1
0
mirror of https://github.com/actions/setup-dotnet.git synced 2025-05-15 22:23:45 +07:00

12 lines
360 B
JavaScript
Raw Normal View History

2019-09-09 10:27:23 -07:00
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), []);
}