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

Function isHomepage

middleware/contextualizers/product-groups.js:6–18  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

4import { allVersionKeys } from '../../lib/all-versions.js'
5
6const isHomepage = (path) => {
7 const split = path.split('/')
8 // E.g. `/foo` but not `foo/bar` or `foo/`
9 if (split.length === 2 && split[1] && !split[0]) {
10 return languageKeys.includes(split[1])
11 }
12 // E.g. `/foo/possiblyproductname` but not `foo/possiblyproductname` or
13 // `/foo/something/`
14 if (split.length === 3 && !split[0] && split[2]) {
15 return allVersionKeys.includes(split[2])
16 }
17 return false
18}
19
20export default async function productGroups(req, res, next) {
21 // It's important to use `req.pathPage` instead of `req.path` because

Callers 1

productGroupsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected