Skip to content

Instantly share code, notes, and snippets.

@luk- luk-/semver.js
Created Sep 23, 2013

What would you like to do?
// 1.0
semver.satisfies('2.1.0', '>2.x.x') // true
// 2.0
semver.satisfies('2.1.0', '>2.x.x') // false

This comment has been minimized.

Copy link

thlorenz commented Sep 23, 2013

It's an odd case, since it depends on what you resolve the first x to,

semver.satisfies('2.1.1', '>2.0.x') // => true seems correct, however

semver.satisfies('2.1.1', '>2.2.x') // => true seems incorrect

This is so much easier with ~ definitions, since it's more deterministic:

semver.satisfies('2.1.1', '~2.0.0') // => true is correct

semver.satisfies('2.1.1', '~2.2.0') // => true is incorrect

I don't know if this is a bug, but would rather argue that > , < and >=, <=, with a non-exact version are problematic and should be considered invalid definitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.