semver icon indicating copy to clipboard operation
semver copied to clipboard

[Feature Request] Support for Semver Ranges

Open Gei0r opened this issue 4 years ago • 5 comments

Hey, could you add support for ranges to the library? These are not in the official standard, but are still widely used.

Example: ^1.2.3 means >= 1.2.3 && < 2.0.0

So maybe add a class semver::range with:

  • a constructor that takes a range string
  • an inRange() method that takes a single semver object and checks if the passed semver fits into the range

Here's the node documentation for semver ranges. This github project also has test cases.

Gei0r avatar Apr 01 '20 18:04 Gei0r

Hi, yes, it looks useful, I will add semver::range

Neargye avatar Apr 01 '20 19:04 Neargye

You want ranges and advanced-range-syntax?

Neargye avatar Apr 01 '20 19:04 Neargye

Yeah, both would be awesome 😎

Gei0r avatar Apr 01 '20 19:04 Gei0r

@Gei0r You might be interested in my version with advanced ranges etc. See tons of examples in tests https://github.com/egorpugin/primitives/blob/master/src/version.cpp#L1839 Root dir https://github.com/egorpugin/primitives/tree/master/src/version

It works in my C++ build system/package manager and you need it to include into your project, again, if you're interested. https://software-network.org/

egorpugin avatar Mar 11 '21 13:03 egorpugin