Skip to content

Instantly share code, notes, and snippets.

@luk-
Created September 23, 2013 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luk-/6666574 to your computer and use it in GitHub Desktop.
Save luk-/6666574 to your computer and use it in GitHub Desktop.
// 1.0
semver.satisfies('2.1.0', '>2.x.x') // true
// 2.0
semver.satisfies('2.1.0', '>2.x.x') // false
@thlorenz
Copy link

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