Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

'satisfies' method sometimes failed #44

Closed
klimashkin opened this Issue · 1 comment

2 participants

@klimashkin

Hello!
If I have Opera 12.00, useragent returns me

{major: '12', minor: '00', patch: '0'}

And then semver 'satisfies' returns error

TypeError: Invalid Version: 12.00.0

because

Agent.prototype.satisfies = function satisfies (range) {
  return semver.satisfies(this.major + '.' + this.minor + '.' + this.patch, range);
};

Maybe it must be like this

Agent.prototype.satisfies = function satisfies (range) {
  return semver.satisfies((Number(this.major) || 0) + '.' + (Number(this.minor) || 0) + '.' + (Number(this.patch) || 0), range);
};
@3rd-Eden
Owner

Yes, that's because the satisfies assumes that the versioning scheme follows the semver specification. Parsing the values down to number would probably be a good idea. Could you create a pull request for that?

@klimashkin klimashkin referenced this issue from a commit in klimashkin/useragent
@klimashkin klimashkin Satisfies with semver fixes #44 383fdf5
@3rd-Eden 3rd-Eden closed this in #50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.