MCPcopy
hub / github.com/github/docs / shortVersions

Function shortVersions

middleware/contextualizers/short-versions.js:9–23  ·  view source on GitHub ↗
(req, res, next)

Source from the content-addressed store, hash-verified

7//
8// For the custom operator handling in statements like {% if ghes > 3.0 %}, see `lib/liquid-tags/if-ver.js`.
9export default function shortVersions(req, res, next) {
10 const { allVersions, currentVersion } = req.context
11 const currentVersionObj = allVersions[currentVersion]
12 if (!currentVersionObj) return next()
13
14 // Add the short name to context.
15 req.context[currentVersionObj.shortName] = true
16
17 // Add convenience props.
18 req.context.currentVersionObj = currentVersionObj
19 req.context.currentRelease = currentVersion.split('@')[1]
20 req.context.currentVersionShortName = currentVersionObj.shortName
21
22 return next()
23}

Callers 1

category-pages.jsFile · 0.85

Calls 1

nextFunction · 0.50

Tested by

no test coverage detected