5 releases (stable)

2.1.0 Sep 21, 2022
2.0.1 Sep 4, 2022
2.0.0 Sep 26, 2021
1.0.1 Sep 24, 2021
0.1.0 May 19, 2021

#257 in Encoding

Download history 2420/week @ 2024-03-14 3165/week @ 2024-03-21 3022/week @ 2024-03-28 3588/week @ 2024-04-04 4490/week @ 2024-04-11 3505/week @ 2024-04-18 3063/week @ 2024-04-25 4345/week @ 2024-05-02 4317/week @ 2024-05-09 5197/week @ 2024-05-16 4598/week @ 2024-05-23 4229/week @ 2024-05-30 5122/week @ 2024-06-06 4161/week @ 2024-06-13 3895/week @ 2024-06-20 2906/week @ 2024-06-27

16,882 downloads per month
Used in 24 crates (16 directly)

Apache-2.0

86KB
2K SLoC

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.

It also supports serde serialization, converting versions and ranges to strings.

Usage

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

use node_semver::{Range, Version};

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

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

Dependencies

~2–2.8MB
~51K SLoC