MCPcopy
hub / github.com/palantir/blueprint / transformDocumentalistData

Function transformDocumentalistData

packages/docs-data/compile-docs-data.js:70–87  ·  view source on GitHub ↗
(key, value)

Source from the content-addressed store, hash-verified

68}
69
70function transformDocumentalistData(key, value) {
71 if (key === "versions" && Array.isArray(value)) {
72 // one major version per release
73 const majors = new Map();
74 for (const version of value) {
75 const major = semver.major(version);
76 if (!majors.has(major) || semver.gt(version, majors.get(major))) {
77 majors.set(major, version);
78 }
79 }
80 // reverse the list so highest version is first (easier indexing)
81 return Array.from(majors.values()).reverse();
82 }
83 if (value != null) {
84 return replaceNS(value);
85 }
86 return undefined;
87}
88
89/** @param {any} text replace `#{$ns}` with Blueprint class namespace. if not a string, simply returns `text`. */
90function replaceNS(text) {

Callers

nothing calls this directly

Calls 3

replaceNSFunction · 0.85
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected