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 🙏

© 2026 – Pkg Stats / Ryan Hefner

qversion

v0.4.2

Published

quick version number comparator

Readme

qversion

quick version number comparator

Compares semantic version numbers. Semantic version numbers are a dotted numeric tuple in the form major . minor . patch. QVersion allows any number of dotted fields, but npm and node use exactly 3.

    QVersion = require('qversion');
    QVersion.version_compare("1.1.2", "1.1.10");    // => -1

    ver = new QVersion();
    ver.match("1.1.3", "1.1.*");                    // => true
    ver.match("1.1.3", "1.1.2,1.1.3");              // => true

Installation

    npm install qversion
    qunit test-qversion.js

If you already have semver installed, you can run the benchmark:

    $ node node_modules/qversion/benchmark.js
    qversion match: 23 ms
    semversion satisfies: 368 ms
    qversion match: 16 ms
    semversion satisfies: 330 ms

Functions

QVersion.version_compare( ver1, ver2 )

compare the two version numbers, return less than zero if ver1 is less than ver2, 0 if they are the same, greater than zero if ver1 is greater than ver2. A match has to be exact, 1 is not 1.0 is not 1.0.0.

QVersion.version_match( version, pattern )

test the version against the pattern, and return true if the version matches. The pattern may be specified as a match template or a comma-separated list of templates. Each template may be a:

    1.1,1.2         comma-list of templates
    1.1.1-1.1.7     range match
    1.1.*           prefix match
    1.1.x           prefix match (same as 1.1.*)
    1.1             prefix match (same as 1.1.*)
    >1.1            relative match (also >=, <, <=)
    *               any version (wildcard match)

The semantics of approximate match ~1.1 are not yet well defined; currently it is implemented as a prefix match.

qv = new QVersion( [options] )

QVersion object caches results to speed repeated lookups

Options:

  • version_compare - function that compares two versions and returns -1, 0 or 1 as above
  • version_match - function that matches a version against a pattern as above

qv.compare( ver1, ver2 )

cached version_compare

qv.match( ver, patt )

cached version_match

Limitations

  • QVersion does not implement full SemVer semantics
  • patch suffixes (eg 1.2.1-patch3) are not supported

Todo

  • unit test version_match
  • unit test QVersion
  • write a version_select() that returns best match of desired vs available
  • support non-numeric version numbers?

Related Work