MCPcopy Create free account
hub / github.com/anomalyco/opencode / fromDocsPathname

Function fromDocsPathname

packages/console/app/src/lib/language.ts:188–195  ·  view source on GitHub ↗
(pathname: string)

Source from the content-addressed store, hash-verified

186}
187
188export function fromDocsPathname(pathname: string) {
189 const next = fix(pathname)
190 const value = next.split("/")[2]?.toLowerCase()
191 if (!value) return null
192 if (!next.startsWith("/docs/")) return null
193 if (!(value in DOCS_LOCALE)) return null
194 return DOCS_LOCALE[value as keyof typeof DOCS_LOCALE]
195}
196
197export function strip(pathname: string) {
198 const locale = fromPathname(pathname)

Callers 1

localeFromRequestFunction · 0.85

Calls 1

fixFunction · 0.70

Tested by

no test coverage detected