MCPcopy
hub / github.com/github/docs / constructor

Method constructor

lib/permalink.js:31–47  ·  view source on GitHub ↗
(languageCode, pageVersion, relativePath, title)

Source from the content-addressed store, hash-verified

29*/
30class Permalink {
31 constructor(languageCode, pageVersion, relativePath, title) {
32 this.languageCode = languageCode
33 this.pageVersion = pageVersion
34 this.relativePath = relativePath
35 this.title = title
36
37 const permalinkSuffix = this.constructor.relativePathToSuffix(relativePath)
38
39 this.hrefWithoutLanguage = removeFPTFromPath(
40 path.posix.join('/', pageVersion, permalinkSuffix)
41 ).replace(patterns.trailingSlash, '$1')
42 this.href = `/${languageCode}${
43 this.hrefWithoutLanguage === '/' ? '' : this.hrefWithoutLanguage
44 }`
45
46 return this
47 }
48
49 static derive(languageCode, relativePath, title, applicableVersions) {
50 assert(relativePath, 'relativePath is required')

Callers

nothing calls this directly

Calls 2

removeFPTFromPathFunction · 0.85
relativePathToSuffixMethod · 0.80

Tested by

no test coverage detected