@hediet/semver
v0.2.2
Published
A typed implementation of the Semantic Version 2.0.0 specification.
Downloads
7,128
Readme
@hediet/semver - TypeScript Implementation of The Semantic Version Specification
A sane TypeScript implementation of the Semantic Version specification 2.0.0. Some features are still missing but will be implemented eventually.
Install
To install the library:
yarn add @hediet/semver
Features
- Parse/Stringify versions
- Modify/Increment versions
- Versions are immutable
Examples
const ver = SemanticVersion.parse("1.0.0-alpha.1");
equal(ver.major, 1);
const ver1 = ver.with({ prerelease: null });
equal(ver1.toString(), "1.0.0");
const ver2 = ver.with({ patch: "increment" });
equal(ver2.toString(), "1.0.1-alpha.1");
const ver3 = ver.with({ patch: "increment", prerelease: null });
equal(ver3.toString(), "1.0.1");