npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

wonderful-version

v1.3.2

Published

A far-less-frustrating rendition of semver

Readme

🌐 Wonderful Version Works in Node AND browser environments

Yes, this module works in both Node and browser environments, including compatibility with Webpack and Browserify!

🦄 Features

  • Gracefully check semantic versions instead of throwing errors

📦 Install Wonderful Version

Option 1: Install via npm

Install with npm if you plan to use wonderful-version in a Node project or in the browser.

npm install wonderful-version

If you plan to use wonderful-version in a browser environment, you will probably need to use Webpack, Browserify, or a similar service to compile it.

const wonderfulVersion = require('wonderful-version');

Option 2: Install via CDN

Install with CDN if you plan to use Wonderful Version only in a browser environment.

<script src="https://cdn.jsdelivr.net/npm/wonderful-version@latest/dist/index.min.js"></script>
<script type="text/javascript">
  var wonderfulVersion = WonderfulVersion;
</script>

⚡️ Usage

.clean(version)

Cleans a version string by removing non-numeric characters and trailing zeros.

console.log(wonderfulVersion.clean('v1.02.30')); // '1.2.3'

.equals(version1, version2)

Checks if two version strings are equal after cleaning.

console.log(wonderfulVersion.equals('1.0.0', '1')); // true

.lessThan(version1, version2)

Checks if version1 is less than version2.

console.log(wonderfulVersion.lessThan('1.2.3', '1.2.4')); // true

.greaterThan(version1, version2)

Checks if version1 is greater than version2.

console.log(wonderfulVersion.greaterThan('1.2.4', '1.2.3')); // true

.lessThanOrEqual(version1, version2)

Checks if version1 is less than or equal to version2.

console.log(wonderfulVersion.lessThanOrEqual('1.2.3', '1.2.4')); // true

.greaterThanOrEqual(version1, version2)

Checks if version1 is greater than or equal to version2.

console.log(wonderfulVersion.greaterThanOrEqual('1.2.4', '1.2.3')); // true

.is(version1, comparator, version2)

Checks if version1 is ['===', '!=', '>', '>=', '<', '<='] to version2.

console.log(wonderfulVersion.is('1.2.4', '>=', '1.2.3')); // true
console.log(wonderfulVersion.is('1.2.4', '!=', '1.2.3')); // true
console.log(wonderfulVersion.is('1.2.4', '===', '1.2.4')); // true

.major(version)

Returns the major version number.

console.log(wonderfulVersion.major('1.2.3')); // 1

.minor(version)

Returns the minor version number.

console.log(wonderfulVersion.minor('1.2.3')); // 2

.patch(version)

Returns the patch version number.

console.log(wonderfulVersion.patch('1.2.3')); // 3

.levelDifference(version1, version2)

Determines which version level (major, minor, or patch) version1 is behind compared to version2.

console.log(wonderfulVersion.behindLevel('1.2.3', '2.0.0')); // 'major'

.increment(version, level, amount)

Increments a version number by a certain level and amount. Segments following the incremented level are reset to 0.

console.log(wonderfulVersion.increment('1.2.3', 'major', 1)); // '2.0.0'
console.log(wonderfulVersion.increment('1.2.3', 'minor', 1)); // '1.3.0'
console.log(wonderfulVersion.increment('1.2.3', 'patch', 1)); // '1.2.4'

📘 Using Wonderful Version

After you have followed the install step, you can start using wonderful-version to enhance your project.

For a more in-depth documentation of this library and the Wonderful Version service, please visit the official Wonderful Version website.

📝 What Can Wonderful Version do?

A far-less-frustrating rendition of semver

🗨️ Final Words

If you are still having difficulty, we would love for you to post a question to the Wonderful Version issues page. It is much easier to answer questions that include your code and relevant files! So if you can provide them, we'd be extremely grateful (and more likely to help you find the answer!)

📚 Projects Using this Library

Ask us to have your project listed! :)