js-semver 0.2.0

Parser and evaluator for semantic versioning in JavaScript, including Node.js and Deno
Documentation
  • Coverage
  • 100%
    19 out of 19 items documented1 out of 1 items with examples
  • Size
  • Source code size: 120.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.79 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 25s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ryuapp/js-semver
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ryuapp
js-semver-0.2.0 has been yanked.

js-semver

License crates github repo codecov

A parser and evaluator for semantic versioning in JavaScript, including Node.js and Deno.

This crate is designed for the JavaScript ecosystem. It maintains high compatibility with the behavior of node-semver (the one npm uses) and has zero dependencies by default.

Example

use js_semver::{BuildMetadata, PreRelease, Range, Version};

fn main() {
    let range = Range::parse(">=1.2.3 <1.8.0").unwrap();

    // Pre-release versions are not included in the range unless explicitly specified.
    let version = Version {
        major: 1,
        minor: 2,
        patch: 3,
        pre_release: PreRelease::parse("alpha.1").unwrap(),
        build: BuildMetadata::default(),
    };
    assert!(!range.satisfies(&version));

    let version = Version::parse("1.3.0").unwrap();
    assert!(range.satisfies(&version));
}

Comparison with other crates

node-semver

node-semver crate has numerous issues, including unnecessary dependencies like miette, incompatibilities with npm's node-semver, and the fact that it is no longer actively maintained.

semver

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