Skip to main content
Bun.semver compares semantic versions and checks whether a version is compatible with a range of versions. Versions and ranges are designed to be compatible with node-semver, which npm clients use. It’s about 20x faster than node-semver.
Benchmark
The API provides two functions:

Bun.semver.satisfies(version: string, range: string): boolean

Returns true if version satisfies range, otherwise false. Example:
If range or version is invalid, it returns false.

Bun.semver.order(versionA: string, versionB: string): 0 | 1 | -1

Returns 0 if versionA and versionB are equal, 1 if versionA is greater than versionB, and -1 if versionA is less than versionB. Example:
If you need other semver functions, feel free to open an issue or pull request.