MCPcopy
hub / github.com/parse-community/parse-server / getNewerVersion

Method getNewerVersion

ci/CiVersionCheck.js:187–203  ·  view source on GitHub ↗

* Returns the latest version for a given version and component. * @param {Array } versions The versions in which to search. * @param {String} version The version for which a newer version * should be searched. * @param {String} versionComponent The version component up to * whi

(versions, version, versionComponent)

Source from the content-addressed store, hash-verified

185 * @returns {String|undefined} The newer version.
186 */
187 getNewerVersion(versions, version, versionComponent) {
188 // Determine operator for range comparison
189 const operator = versionComponent == CiVersionCheck.versionComponents.major
190 ? '>='
191 : versionComponent == CiVersionCheck.versionComponents.minor
192 ? '^'
193 : '~'
194 const latest = semver.maxSatisfying(versions, `${operator}${version}`);
195
196 // If the version should be ignored, skip it
197 if (this.ignoreReleasedVersions.length > 0 && semver.satisfies(latest, this.ignoreReleasedVersions.join(' || '))) {
198 return undefined;
199 }
200
201 // Return the latest version if it is newer than any currently used version
202 return semver.gt(latest, version) ? latest : undefined;
203 }
204
205 /**
206 * This validates that the given versions strictly follow semver

Callers 1

checkMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected