Skip to content

Compare semver version strings to find greater, equal or lesser.

License

Notifications You must be signed in to change notification settings

jvanderen1/compare-versions

Repository files navigation

Build Test Coverage Status npm bundle size (minified + gzip)

Compare semver version strings to find greater, equal or lesser.

  • Runs in any Javascript environment.
  • No dependencies.
  • Tiny build size.

Supports the full semver specification including versions with different number of digits like 1.0.0, 1.0, 1 and pre-releases like 1.0.0-alpha. Additionally supports the following variations:

  • Wildcards for minor and patch version like 1.0.x or 1.0.*.
  • Chromium version numbers with 4 parts, e.g. version 25.0.1364.126.
  • Any leading v is ignored, e.g. v1.0 is interpreted as 1.0.
  • Leading zero is ignored, e.g. 1.01.1 is interpreted as 1.1.1.

⬇️ Install

npm install @jvanderen1/compare-versions

📕 Documentation

Please visit https://jvanderen1.github.io/compare-versions/

🤝 Compatability

The following bundles are generated:

Module Type File Name
ESM compare-versions.mjs
CommonJS compare-versions.cjs
UMD compare-versions.umd.js

🙌 Acknowledgment

This project would not be possible without the original compare-versions project! Thank you.