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 🙏

© 2024 – Pkg Stats / Ryan Hefner

reviewers-edition-upgrade

v1.0.2

Published

decide if users should automatically upgrade to a new Reviewers Edition

Downloads

10

Readme

This npm package exports a single function. The function takes two Reviewers Edition string arguments and returns true if users of the first argument edition should automatically upgrade to the second argument edition, false if they should not. The function throws an exception if either argument is not a valid Reviewers Edition string.

var upgrade = require('reviewers-edition-upgrade')

Examples

The following examples are also the test suite for the function. The tests use Node.js' built-in assert module.

var assert = require('assert')

Automatically upgrade from an edition to a correction.

assert(upgrade('1e', '1e1c'))

Automatically upgrade from an update to a correction.

assert(upgrade('1e1u', '1e1u1c'))

Automatically upgrade from a correction to another correction.

assert(upgrade('1e1u1c', '1e1u2c'))

Automatically upgrade from a draft to a later draft.

assert(upgrade('1e1d', '1e2d'))

Automatically upgrade from a draft to the final new edition.

assert(upgrade('1e1d', '1e'))

Automatically upgrade from a draft to a correction.

assert(upgrade('1e1d', '1e1c'))

Do not automatically upgrade to new editions.

assert(!upgrade('1e', '2e'))

Do not automatically upgrade to updates.

assert(!upgrade('1e', '1e1u'))

Do not automatically upgrade from one update to another update.

assert(!upgrade('1e1u', '1e2u'))

Do not automatically upgrade to drafts of updates.

assert(!upgrade('1e1u', '1e2u1d'))

Do not automatically upgrade to drafts of corrections.

assert(!upgrade('1e1u', '1e1u1c1d'))

Do not automatically upgrade to drafts of new editions.

assert(!upgrade('1e1u', '1e1u1c1d'))

The function throws an error if it receives an invalid Reviewers Edition string argument.

assert.throws(function() {
  upgrade('1.0.0', '1e')
})

assert.throws(function() {
  upgrade('1e', '1.0.0')
})

Comparison to node-semver's satisfies

Usage is analogous to node-semver's .satisfies(), with three key exceptions:

  1. satisfies takes the constraint (a "sevmer range") as its second argument, while reviewers-edition-upgrade takes the constraint (the current reviewer edition) as its first argument.

  2. node-semver uses different syntax for constraints ("ranges") and versions. reviewers-edition-upgrade uses valid Reviewers Editions for both constraints and versions.

  3. While their syntaxes are similar, the meanings and purposes of semantic versions and Reviewers Editions are different.

At a high level, reviewers-edition-upgrade supports fewer kinds of constraints, and the constraints it does support are conservative relative to what node-semver supports. Starting editions like 1e, 1e1u, and 1e1u1c are loosely analogous to ~1.0.0, ~1.1.0, and ~1.1.1, respectively. Starting editions with draft numbers, like 1e1d, are loosely analogous to ranges like ~1.0.0-alpha.1.

reved

This package is bundled with other functions for creating and manipulating Reviewers Editions in reved.