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

Function getDocsVersion

lib/all-versions.js:130–140  ·  view source on GitHub ↗
(openApiVersion)

Source from the content-addressed store, hash-verified

128// There is a mapping between the version names. This gets the Docs version from
129// the OpenAPI version name (the filename )
130export function getDocsVersion(openApiVersion) {
131 const matchingVersion = Object.values(allVersions).find((version) =>
132 openApiVersion.startsWith(version.openApiVersionName)
133 )
134
135 if (!matchingVersion) {
136 throw new Error(`Error: Could not find a matching version for ${openApiVersion}.`)
137 }
138
139 return matchingVersion.version
140}
141
142export { allVersions }

Callers 2

all-versions.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected