MCPcopy Index your code
hub / github.com/github/docs / getOldVersionFromOldPath

Function getOldVersionFromOldPath

lib/old-versions-utils.js:38–45  ·  view source on GitHub ↗
(oldPath)

Source from the content-addressed store, hash-verified

36// Given an old path like /enterprise/2.21/user/github/category/article,
37// return an old version like 2.21.
38export function getOldVersionFromOldPath(oldPath) {
39 // We should never be calling this function on a path that starts with a new version,
40 // so we can assume the path either uses the old /enterprise format or it's dotcom.
41 if (!patterns.enterprise.test(oldPath)) return 'dotcom'
42
43 const ghesNumber = oldPath.match(patterns.getEnterpriseVersionNumber)
44 return ghesNumber ? ghesNumber[1] : latest
45}
46
47// Given an old path like /en/enterprise/2.21/user/github/category/article,
48// return a new path like /en/enterprise-server@2.21/github/category/article.

Callers 1

getNewVersionedPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected