compare-versions icon indicating copy to clipboard operation
compare-versions copied to clipboard

satisfies return false if minor version is lower

Open GregoireDucharme opened this issue 2 years ago • 0 comments

I'm checking if 2.0.0 satisfies >=1.10 and I'm getting false:

        console.log(compare("2.0.0", "1.1.0", '>=')); // true
        console.log(satisfies("2.0.0", ">=1.1.0")); // false

In my exemple you go directly though compare whenre calling statsifies function since operator is >=:

I tried

      console.log(`s1 ${s1[i]} and s2 ${s2[i]}`)
      console.log(`n1 ${n1} and n2 ${n2}`)

In function compareVersions(v1, v2)

here is the output:


 LOG  s1 1 and s2 >=0
 LOG  n1 1 and n2 NaN
 LOG  s1 0 and s2 1
 LOG  n1 0 and n2 1

therefore I think remove the operator after the match in the satisfies should and does fix the issue.

GregoireDucharme avatar Jun 17 '22 10:06 GregoireDucharme