MCPcopy
hub / github.com/refined-github/refined-github / buildRepoUrl

Function buildRepoUrl

source/github-helpers/index.ts:25–35  ·  view source on GitHub ↗
(
	...pathParts: RequireAtLeastOne<Array<UnslashedString<S> | number>, 0>
)

Source from the content-addressed store, hash-verified

23type UnslashedString<S extends string> = Not<S, `/${string}` | `${string}/`>;
24
25export function buildRepoUrl<S extends string>(
26 ...pathParts: RequireAtLeastOne<Array<UnslashedString<S> | number>, 0>
27): string {
28 for (const part of pathParts) {
29 if (typeof part === 'string' && /^\/|\/$/.test(part)) {
30 throw new TypeError('The path parts shouldn’t start or end with a slash: ' + part);
31 }
32 }
33
34 return [location.origin, getRepo()?.nameWithOwner, ...pathParts].join('/');
35}
36
37export function getForkedRepo(): string | undefined {
38 return $optional('meta[name="octolytics-dimension-repository_parent_nwo"]')?.content;

Callers 15

linkifyCommitFunction · 0.85
alterLinkFunction · 0.85
addLinkFunction · 0.85
buildLastCommitsPageUrlFunction · 0.85
linkifyFunction · 0.85
initFunction · 0.85
addStarsFunction · 0.85
addCiStatusFunction · 0.85
getPrUrlFunction · 0.85
getHovercardUrlFunction · 0.85
initFunction · 0.85
initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected