MCPcopy Index your code
hub / github.com/parse-community/parse-server / getHigherVersions

Method getHigherVersions

ci/nodeEngineCheck.js:111–125  ·  view source on GitHub ↗

* Returns the highest semver definition that satisfies all versions * in the given list. * @param {String[]} versions The list of semver version ranges. * @param {String} baseVersion The base version of which higher versions should be * determined; as a version (1.2.3), not a range (>=1.

({ versions, baseVersion })

Source from the content-addressed store, hash-verified

109 * @returns {String} The highest semver version.
110 */
111 getHigherVersions({ versions, baseVersion }) {
112 // Add min satisfying node versions
113 const minVersions = versions.map(v => {
114 v.nodeMinVersion = semver.minVersion(v.nodeVersion)
115 return v;
116 });
117
118 // Sort by min version
119 const sortedMinVersions = minVersions.sort((v1, v2) => semver.compare(v1.nodeMinVersion, v2.nodeMinVersion));
120
121 // Filter by higher versions
122 const higherVersions = sortedMinVersions.filter(v => semver.gt(v.nodeMinVersion, baseVersion));
123 // console.log(`getHigherVersions: ${JSON.stringify(higherVersions)}`);
124 return higherVersions;
125 }
126
127 /**
128 * Returns the node version of the parent package.

Callers 1

checkFunction · 0.95

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected