( ...pathParts: RequireAtLeastOne<Array<UnslashedString<S> | number>, 0> )
| 23 | type UnslashedString<S extends string> = Not<S, `/${string}` | `${string}/`>; |
| 24 | |
| 25 | export 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 | |
| 37 | export function getForkedRepo(): string | undefined { |
| 38 | return $optional('meta[name="octolytics-dimension-repository_parent_nwo"]')?.content; |
no outgoing calls
no test coverage detected