major-versions

2.2.1 • Public • Published

major-versions Build Status Greenkeeper badge

Get all the major versions within a semver range

Installing

$ npm install --save major-versions

Usage

var majors = require('major-versions')
majors('>=2 <5') // => ['2', '3', '4']
majors('>=2 <5 || 10') // => ['2', '3', '4', '10']
majors('<2 >5') // => []

API

majors(range, [maximum]) -> array[string]

range

Required
Type: string

A semver range.

maximum

Type: string

A maximum to apply. An exception will be thrown for an unbounded range (e.g. '>5') if no maximum is provided. The maximum must lie within the range. Most times you'll query a package registry for a specific version (e.g. latest) and use it as the maximum.

majors('>=2', '4.1.2', ['2', '3', '4'])

Caveats

If you pass a range in 0.y.z, the library will throw an exception unless you define a maximum or your range resolves to an exact version.

/major-versions/

    Package Sidebar

    Install

    npm i major-versions

    Weekly Downloads

    182

    Version

    2.2.1

    License

    MIT

    Unpacked Size

    6.89 kB

    Total Files

    4

    Last publish

    Collaborators

    • bendrucker