semver-range-intersect
Get the intersection of multiple semver ranges.
Last updated 5 years ago by sounisi5011 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install semver-range-intersect 
SYNC missed versions from official npm registry.

semver-range-intersect

npm package GitHub License Type Definitions: TypeScript Build Status Maintainability Status

Get the intersection of multiple semver ranges.

Install

npm install semver-range-intersect

Usage

const { intersect } = require('semver-range-intersect');

// equals to: '^4.1.0'
intersect('^4.0.0', '^4.1.0') === '>=4.1.0 <5.0.0'

// equals to: 1.1.0 - 1.4.0
intersect('1.1.0 - 1.2.3 || 1.2.0 - 1.4.0') === '>=1.1.0 <=1.4.0'

intersect('8.2.6 - 8.x.x', '<=8.6.9') === '>=8.2.6 <=8.6.9'

intersect('^6.0.0', '6.7.9') === '6.7.9'

// equals to: ^8.15.0 || ^10.13.0 || >=11.10.1
intersect('^8.15.0 || >=10.0.0', '^8.10.0 || ^10.13.0 || >=11.10.1') === '>=8.15.0 <9.0.0 || >=10.13.0 <11.0.0 || >=11.10.1'

intersect('x.x.x') === '*'

// null for invalid version
intersect('a.b.c') === null

// null for version range not crossing
intersect('^2.0.0', '^5.0.0') === null
intersect('8.2.6 - 8.x.x', '>=9.0.1') === null

Tests

To run the test suite, first install the dependencies, then run npm test:

npm install
npm test

Contributing

see CONTRIBUTING.md

Related

Current Tags

  • 0.3.1                                ...           latest (5 years ago)

4 Versions

  • 0.3.1                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE