MCPcopy
hub / github.com/github/docs / getPathWithoutVersion

Function getPathWithoutVersion

lib/path-utils.js:26–33  ·  view source on GitHub ↗
(href)

Source from the content-addressed store, hash-verified

24
25// Remove the version segment from the path
26export function getPathWithoutVersion(href) {
27 const versionFromPath = getVersionStringFromPath(href)
28
29 // If the derived version is not found in the list of all versions, just return the HREF
30 return allVersions[versionFromPath]
31 ? href.replace(`/${getVersionStringFromPath(href)}`, '')
32 : href
33}
34
35// Return the version segment in a path
36export function getVersionStringFromPath(href, supportedOnly = false) {

Callers 5

learningTrackFunction · 0.90
mainFunction · 0.90
permalinkRedirectsFunction · 0.90
server.jsFile · 0.90
contextualizeFunction · 0.85

Calls 1

getVersionStringFromPathFunction · 0.85

Tested by

no test coverage detected