Skip to content

Commit

Permalink
Add equals() to semver version()
Browse files Browse the repository at this point in the history
  • Loading branch information
Maingron committed Feb 14, 2025
1 parent 378b514 commit 6732eb4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions system/modules/semver.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ export function version(versionString = 0) {

const returnObj = {
toString: toString,
isNewerThan: function(right, verbose = false) {
if(!right) {
isNewerThan: function(otherVersion, verbose = false) {
if(!otherVersion) {
throw new Error("Expected a version to compare to.");
}
return isNewerThan(this, right, verbose);
return isNewerThan(this, otherVersion, verbose);
},
equals: function(otherVersion) {
if (!otherVersion) {
throw new Error("Expected a version to compare to.");
}

return this.version == version(otherVersion).version;
},
get major() {
return major;
Expand Down

0 comments on commit 6732eb4

Please sign in to comment.