web: Rename Version.is_stable_or_compatible_prerelease to

Version.isStableOrCompatiblePrerelease
This commit is contained in:
Nathan Adams 2020-11-13 22:52:30 +01:00 committed by Mike Welsh
parent 6952197004
commit a0817e48b0
3 changed files with 5 additions and 11 deletions

View File

@ -30,7 +30,7 @@ export class VersionRange {
const version = this.requirements[i][j].version; const version = this.requirements[i][j].version;
matches = matches =
matches && version.is_stable_or_compatible_prerelease(fver); matches && version.isStableOrCompatiblePrerelease(fver);
if (comparator === "" || comparator === "=") { if (comparator === "" || comparator === "=") {
matches = matches && version.isEqual(fver); matches = matches && version.isEqual(fver);

View File

@ -214,7 +214,7 @@ export class Version {
* @return True if the given version is either stable, or a * @return True if the given version is either stable, or a
* prerelease in the same series as this one. * prerelease in the same series as this one.
*/ */
is_stable_or_compatible_prerelease(fver: Version): boolean { isStableOrCompatiblePrerelease(fver: Version): boolean {
if (fver.prIdent == null) { if (fver.prIdent == null) {
return true; return true;
} else { } else {

View File

@ -184,9 +184,7 @@ describe("Version", function () {
const tests = flatten(testMatrix); const tests = flatten(testMatrix);
for (const version of tests) { for (const version of tests) {
assert.isOk( assert.isOk(
Version.fromSemver( Version.fromSemver(version).isStableOrCompatiblePrerelease(
version
).is_stable_or_compatible_prerelease(
Version.fromSemver(version) Version.fromSemver(version)
), ),
`${version} is compatible with itself` `${version} is compatible with itself`
@ -198,9 +196,7 @@ describe("Version", function () {
for (const a of tests) { for (const a of tests) {
for (const b of tests) { for (const b of tests) {
assert.isOk( assert.isOk(
Version.fromSemver( Version.fromSemver(a).isStableOrCompatiblePrerelease(
a
).is_stable_or_compatible_prerelease(
Version.fromSemver(b) Version.fromSemver(b)
), ),
`${a} is compatible with ${b}` `${a} is compatible with ${b}`
@ -214,9 +210,7 @@ describe("Version", function () {
for (const b of tests) { for (const b of tests) {
if (a === b) continue; if (a === b) continue;
assert.isNotOk( assert.isNotOk(
Version.fromSemver( Version.fromSemver(a).isStableOrCompatiblePrerelease(
a
).is_stable_or_compatible_prerelease(
Version.fromSemver(b) Version.fromSemver(b)
), ),
`${a} is not compatible with ${b}` `${a} is not compatible with ${b}`