Skip to content

Commit

Permalink
fix: avoid re-instantiating SemVer during diff compare (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
macno committed Apr 12, 2023
1 parent 82aa7f6 commit 2781767
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions functions/diff.js
@@ -1,10 +1,9 @@
const parse = require('./parse')
const eq = require('./eq')

const diff = (version1, version2) => {
const v1 = parse(version1)
const v2 = parse(version2)
if (eq(v1, v2)) {
if (v1.compare(v2) === 0) {
return null
} else {
const hasPre = v1.prerelease.length || v2.prerelease.length
Expand Down

0 comments on commit 2781767

Please sign in to comment.