MCPcopy
hub / github.com/github/docs / getCategoryStringFromPath

Function getCategoryStringFromPath

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

Source from the content-addressed store, hash-verified

106}
107
108export function getCategoryStringFromPath(href) {
109 href = getPathWithoutLanguage(href)
110
111 if (href === '/') return null
112
113 const pathParts = href.split('/')
114
115 if (pathParts.includes('early-access')) return null
116
117 const productIndex = productIds.includes(pathParts[2]) ? 2 : 1
118
119 return pathParts[productIndex + 1]
120}
121
122export default {
123 getPathWithLanguage,

Callers 1

contextualizeFunction · 0.85

Calls 1

getPathWithoutLanguageFunction · 0.85

Tested by

no test coverage detected