Giter VIP home page Giter VIP logo

node-semver-extra's Introduction

NPM version Build Status

semver-extra

semver-extra contains useful methods that aren't included in the vanilla semver package.

The main reason semver-extra exists is to deal with pre-release versions.

Install

$ npm install semver-extra --save

Usage

var semver = require('semver-extra');

First of all, semver-extra contains all methods of [email protected], so we could use semver-extra only without the vanilla one.

semver.validRange('^1.2.3'); // '>=1.2.3-0 <2.0.0-0'

semver.isStable(version)

semver.isStable('1.2.3');        // -> true
semver.isStable('1.2.3-stable'); // -> false
semver.isStable('1.2.3-alpha');  // -> false

Checks whether the version is a stable version.

semver.isPrerelease(version, [prerelease])

  • version string
  • prerelease String=
    • If argument prerelease is not passed and version is an unstable version, it will return true.
    • or prerelease could be the pre-release string.
semver.isPrerelease('1.2.3'); // false
semver.isPrerelease('1.2.3-beta'); // true
semver.isPrerelease('1.2.3-beta', 'alpha'); // false
semver.isPrerelease('1.2.3-1.2.3', '1.2.3'); // true, that supports numeric prerelease versions
semver.isPrerelease('1.2.3-alpha.1', 'alpha.1'); // true

Checks whether the version is an unstable version or matches the prerelease.

var versions = [
  '1.1.2'
  '1.2.3-beta',
  '1.2.2',
  '1.2.1',
  '1.3.3',
  '1.5.0-rc'
];

semver.max(versions)

semver.max(versions); // '1.5.0-rc'

Returns String the maximun version in the list.

semver.maxStable(versions)

semver.maxStable(versions); // '1.3.3'

Returns String the maximun stable version in the list.

semver.maxPrerelease(versions, [prerelease])

semver.maxPrerelease(versions, 'alpha'); // null
semver.maxPrerelease(versions); // '1.5.0-rc'
semver.maxPrerelease(versions, 'beta'); // '1.2.3-beta'

Returns the maximun (matched) pre-release version matches the prerelease.

License

MIT

node-semver-extra's People

Contributors

evgenus avatar kaelzhang avatar

Stargazers

 avatar Subhajit Sahu avatar Tymoteusz Dzienniak avatar  avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

evgenus

node-semver-extra's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.