MCPcopy
hub / github.com/ampproject/amphtml / getNodeLatestLtsVersion

Function getNodeLatestLtsVersion

build-system/common/check-package-manager.js:173–186  ·  view source on GitHub ↗

* Extracts the latest node version from a JSON object containing version info * * @param {!Object} distributionsJson * @return {string}

(distributionsJson)

Source from the content-addressed store, hash-verified

171 * @return {string}
172 */
173function getNodeLatestLtsVersion(distributionsJson) {
174 if (distributionsJson) {
175 // Versions are in descending order, so the first match is the latest lts.
176 return distributionsJson.find(function (distribution) {
177 return (
178 distribution.hasOwnProperty('version') &&
179 distribution.hasOwnProperty('lts') &&
180 distribution.lts
181 );
182 }).version;
183 } else {
184 return '';
185 }
186}
187
188/**
189 * If npm is being run, log its version and proceed with the install.

Callers 1

checkNodeVersionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected