-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
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
Support not SemVer versions #15
Comments
@juherr could you please provide an example of what you mean by support of non-SemVer versions? |
For some bad reasons, we use versions like x.y.zzz.aaa (ie: 1.0.002.001). I looked for a library to compare such format but jsemver doesn't fit because refuse zero-padding (because SemVer don't). Maybe #14 will help. |
Yes, looks similar to what was suggested by @fabianbuch in his pull request. In addition to what I've said in the pull request, I don't think it's a good idea to support all the versioning systems out there, otherwise it wouldn't be a SemVer library anymore. What can be done within the scope of JSemVer is to provide some sort of adapters to convert to/from SemVer-compliant versions. Though, this might lead to loss of version information
...unless you have a special rule of zero padding. Also note that after conversion, the 4th number will be ignored when determining precedence, that is
Will such a functionality be ever useful, that is the question... |
In fact, I am looking for a more generic library which can manage most of version patterns. I think jsemver could be this library and there are some needs, but it's your decision. ;-) |
A partial non-SemVer support that would be really handy would be a String equivalent to Version.forIntegers (which could be rolled into Version.valueOf, I guess). It would accept "partial" versions, such as "1" and "1.0". Since this functionality exists for ints, it would be nice to have it for Strings, too. |
@mwanji there is a subtle difference between |
I understand the resistance, but as you mention in the other issue, partial versions are allowed in comparisons. This behaviour doesn't have to be in valueOf, but not having it at all forces clients to do some parsing of their own, for rather trivial reasons. In my case, I was parsing browser data from caniuse.com, and going from a version string that may or may not have 3 parts to one that does is fairly annoying. |
+1 for allowing partial versions in String parsers. I'm having to special-case those for parsing out REST API versions, which the users want to specify as the string, "2". |
I'll be providing the support for partial versions with the next release ( |
As of 0.10.0 it will be possible to parse shorter versions, but not longer ones. Hopefully the next release will support this. |
Sadly, everyone doesn't use SemVer but it could be useful to use jsemver in order to compare versions in the SemVer way.
In this case, a
boolean isSemVer()
method could be usefull.The text was updated successfully, but these errors were encountered: