MCPcopy
hub / github.com/github/docs / splitPathByLanguage

Function splitPathByLanguage

lib/get-redirect.js:16–24  ·  view source on GitHub ↗
(uri, userLanguage)

Source from the content-addressed store, hash-verified

14const supportedAndRecentlyDeprecated = [...supported, ...deprecatedWithFunctionalRedirects]
15
16export function splitPathByLanguage(uri, userLanguage) {
17 let language = userLanguage || 'en'
18 let withoutLanguage = uri
19 if (languagePrefixRegex.test(uri)) {
20 language = uri.match(languagePrefixRegex)[1]
21 withoutLanguage = uri.replace(languagePrefixRegex, '/')
22 }
23 return [language, withoutLanguage]
24}
25
26// Return the new URI if there is one, otherwise return undefined.
27export default function getRedirect(uri, context) {

Callers 3

getFallbackRedirectFunction · 0.90
getRedirectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected