@veecode-platform/plugin-kong-service-manager
Version:
20 lines (18 loc) • 453 B
JavaScript
function extractGitHubInfo(url) {
const regex = /https:\/\/([^\/]+)\/([^\/]+)\/([^\/]+)\/tree\/([^\/]+)(?:\/(.*))?\/([^\/]+)$/;
const match = url.match(regex);
if (!match) {
throw new Error("Invalid URL");
}
const [_, host, owner, repo, branch, path, file] = match;
return {
host,
owner,
repo,
branch,
path: path || "",
file
};
}
export { extractGitHubInfo };
//# sourceMappingURL=extractGithubInfo.esm.js.map