https://github.com/ryuapp/js-semver
Parser and evaluator for npm's flavor of Semantic Versioning
https://github.com/ryuapp/js-semver
npm rust semver
Last synced: about 2 months ago
JSON representation
Parser and evaluator for npm's flavor of Semantic Versioning
- Host: GitHub
- URL: https://github.com/ryuapp/js-semver
- Owner: ryuapp
- License: mit-0
- Created: 2026-03-21T15:57:36.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-04-05T17:38:44.000Z (2 months ago)
- Last Synced: 2026-04-05T18:22:25.496Z (2 months ago)
- Topics: npm, rust, semver
- Language: Rust
- Homepage:
- Size: 105 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# js-semver
[](https://github.com/ryuapp/js-semver/blob/main/LICENSE)
[](https://crates.io/crates/js-semver)
[](https://github.com/ryuapp/js-semver)
[](https://codecov.io/gh/ryuapp/js-semver)
A parser and evaluator for npm's flavor of Semantic Versioning.
This crate is designed for the JavaScript ecosystem and follows [node-semver](https://github.com/npm/node-semver) (the one npm uses) parsing and range semantics.
It maintains high compatibility and performance, and has zero dependencies by default.
## Example
```rust
use js_semver::{BuildMetadata, PreRelease, Range, Version};
fn main() {
let range: Range = ">=4.1.0 <5.0.0".parse().unwrap();
// Pre-release versions are not included in the range unless explicitly specified.
let version = Version {
major: 4,
minor: 1,
patch: 0,
pre_release: PreRelease::new("rc.1").unwrap(),
build: BuildMetadata::default(),
};
assert!(!range.satisfies(&version));
// Stable version is included in the range.
let version: Version = "4.1.0".parse().unwrap();
assert!(range.satisfies(&version));
}
```
## Comparison with other crates
### node-semver
[node-semver](https://crates.io/crates/node-semver) crate has numerous issues, including unnecessary dependencies like `miette`, incompatibilities with npm's [node-semver](https://github.com/npm/node-semver), and the fact that it is no longer actively maintained.
### semver
[semver](https://crates.io/crates/semver) crate is designed for Cargo. Therefore, it is not well-suited for the Node.js ecosystem, such as parsing versions in `package.json`.
## License
MIT-0
This project's tests incorporate material from third parties, but they are not part of the library. For attribution and additional notice information, see [NOTICE.md](NOTICE.md).