#nodejs #semver #npm #node #parser

nodejs-semver

A node-semver compliant semver implementation in Rust

10 stable releases

4.1.0 Nov 5, 2024
4.0.0 Mar 10, 2024
3.4.0 Jan 6, 2024
3.3.1 Dec 19, 2023
2.2.0 Sep 5, 2023

#283 in Parser implementations

Download history 1779/week @ 2024-08-17 1924/week @ 2024-08-24 1589/week @ 2024-08-31 1587/week @ 2024-09-07 1822/week @ 2024-09-14 2418/week @ 2024-09-21 3530/week @ 2024-09-28 1599/week @ 2024-10-05 1604/week @ 2024-10-12 1350/week @ 2024-10-19 1726/week @ 2024-10-26 2540/week @ 2024-11-02 2784/week @ 2024-11-09 3353/week @ 2024-11-16 4599/week @ 2024-11-23 4320/week @ 2024-11-30

15,473 downloads per month
Used in 5 crates (2 directly)

Apache-2.0

105KB
2.5K SLoC

nodejs-semver

Cargo Documentation

This crate is a pure Rust-based implementation of JavaScript's node-semver. That is, it's designed to be compatible with Node/NPM's particular flavor of semver (which the semver crate is not).

It is designed for Rust programs and libraries meant for JavaScript tooling, and does its best to stay compatible with node-semver.

This project has been forked from node-semver since September of 2023, but a lot has changed; For more details, see Changelog.

Usage

nodejs-semver includes two main types: [Version] and [Range]. See the documentation for more details.:

use nodejs_semver::{Range, Version};

let version: Version = "1.2.3".parse().unwrap();
let range: Range = "^1.2".parse().unwrap();

assert!(version.satisfies(&range));

Optional Features

The following are a list of Cargo features that can be enabled:

  • serde: Provides serialization and deserialization for [Version] and [Range].

Dependencies

~3MB
~58K SLoC