We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lt(undefined, B)
lt(undefined, B) results in true and it seems that's expected: https://github.com/balena-io-modules/resin-semver/blob/master/test/index.spec.ts#L448
true
However I think the result is counter-intuitive and should really be false -- i.e. undefined should always result in false.
false
undefined
The current behaviour prevents writing code that only branches to handle legacy cases, eg.:
if (semver.lt(osVersion, '2.0.0')) { return doLegacy(); } return doNormal();
The above must be written with the "happy path" inverted or check for undefined in the branch condition.
The text was updated successfully, but these errors were encountered:
Even more counter-intuitive is that satisfies seems to work as expected: https://github.com/balena-io-modules/resin-semver/blob/master/test/index.spec.ts#L505
satisfies
So the above could be written:
if (semver.satisfies(osVersion, '<2.0.0')) { return doLegacy(); } return doNormal();
Sorry, something went wrong.
No branches or pull requests
lt(undefined, B)
results intrue
and it seems that's expected: https://github.com/balena-io-modules/resin-semver/blob/master/test/index.spec.ts#L448However I think the result is counter-intuitive and should really be
false
-- i.e.undefined
should always result infalse
.The current behaviour prevents writing code that only branches to handle legacy cases, eg.:
The above must be written with the "happy path" inverted or check for
undefined
in the branch condition.The text was updated successfully, but these errors were encountered: