@sussudio/platform
Version:
Internal APIs for VS Code's service injection the base services.
21 lines (20 loc) • 759 B
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { rtrim } from '@sussudio/base/common/strings.mjs';
export function normalizeGitHubUrl(url) {
// If the url has a .git suffix, remove it
if (url.endsWith('.git')) {
url = url.substr(0, url.length - 4);
}
// Remove trailing slash
url = rtrim(url, '/');
if (url.endsWith('/new')) {
url = rtrim(url, '/new');
}
if (url.endsWith('/issues')) {
url = rtrim(url, '/issues');
}
return url;
}