sounisi5011 / semver-range-intersect Goto Github PK
View Code? Open in Web Editor NEWGet the intersection of multiple semver ranges.
License: MIT License
Get the intersection of multiple semver ranges.
License: MIT License
intersect('1.2.3', '1.2.3') === '1.2.3'
// correct value
intersect('1.2.3 1.2.3') !== '1.2.3'
// return: null
semver.intersects('>1.2.3', '<1.2.3') === null
// correct value
intersect('>1.2.3 <1.2.3') !== null
// return: '>1.2.3 <1.2.3'
intersect('>=1.2.3', '<=1.2.3') !== '1.2.3'
// return: '>=1.2.3 <=1.2.3'
intersect('>=1.2.3 <=1.2.3') !== '1.2.3'
// return: '>=1.2.3 <=1.2.3'
There is no difference in meaning between >=1.2.3 <=1.2.3
and 1.2.3
.
However, the intersect version range is 1.2.3
.
It is appropriate to return 1.2.3
.
any match (eg *
) does not match pre-release.
const semver = require('semver');
semver.satisfies('1.2.3-alpha', '* || >=1.2.3-0') === true
semver.satisfies('1.2.3-alpha', '*') === false
Therefore, it is wrong to convert '* ||> = 1.2.3-0'
to '*'
.
intersect('* || >=1.2.3-0') !== '* || >=1.2.3-0'
// return: '*'
intersect('>2 <2') === null
// never match
intersect('*') === '*'
// any match
intersect('>=1.2.3', '>=2.3.4') === '>=2.3.4'
// intersect range
// -----
intersect('>2 <2 || *') !== '*'
// return: null
intersect('>=1.2.3 || >2 <2', '>=2.3.4') === '>=2.3.4'
// correct value
intersect('>=1.2.3', '>=2.3.4 || >2 <2') !== '>=2.3.4'
// return: '>=1.2.3'
intersect('>=1.2.3 || >2 <2', '>=2.3.4 || >2 <2') !== '>=2.3.4'
// return: null
intersect('* >=2')
// expected: >=2
// return: '' equals *
intersect('* || >=2')
// expected: *
// return: ">=2.0.0 "
intersect('*', '^1.0.2')
// expected: ^1.0.2
// return: '' equals *
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
Warning
These dependencies are deprecated:
Datasource | Name | Replacement PR? |
---|---|---|
npm | eslint-plugin-standard |
|
npm | npm-run-all |
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.
can-npm-publish
, npm-run-all
, package-version-git-tag
)ava
, iter-tools
, ts-node
)These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
husky
, lint-staged
, prettier
, prettier-package-json
, sort-package-json
)@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
, eslint
, eslint-config-prettier
, eslint-config-standard
, eslint-plugin-import
, eslint-plugin-prettier
, eslint-plugin-promise
, eslint-plugin-standard
)husky
, lint-staged
, prettier
, sort-package-json
)@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
, eslint
, eslint-config-prettier
, eslint-config-standard
, eslint-plugin-node
, eslint-plugin-prettier
, eslint-plugin-promise
, eslint-plugin-simple-import-sort
, eslint-plugin-standard
)del-cli
, git-branch-is
, package-version-git-tag
)ava
, fast-deep-equal
, iter-tools
, ts-node
)package.json
@types/semver ^6.0.1
semver ^6.2.0
@typescript-eslint/eslint-plugin 2.0.0
@typescript-eslint/parser 2.0.0
ava 2.2.0
can-npm-publish 1.3.1
del-cli 2.0.0
eslint 6.3.0
eslint-config-prettier 6.1.0
eslint-config-standard 14.1.0
eslint-plugin-import 2.18.2
eslint-plugin-node 9.2.0
eslint-plugin-prettier 3.1.0
eslint-plugin-promise 4.2.1
eslint-plugin-simple-import-sort 4.0.0
eslint-plugin-standard 4.0.1
fast-deep-equal 2.0.1
git-branch-is 2.1.0
husky 3.0.1
is-git-status-clean 1.0.0
iter-tools 6.2.5
lint-staged 9.2.0
npm-run-all 4.1.5
package-version-git-tag 1.1.0
prettier 1.18.2
prettier-package-json 2.1.0
sort-package-json 1.22.1
ts-node 8.3.0
typescript 3.5.3
node >=8.3.0
.travis.yml
node 12
node 12.0.0
node 11
node 11.0.0
node 10
node 10.0.0
node 9
node 9.0.0
node 8
node 8.3.0
semver.validRange()
returns "*"
for all matching version ranges.
const semver = require('semver')
semver.validRange('x.x.x') === '*'
semver.validRange('*') === '*'
semver.validRange('') === '*'
However, intersect()
returns an empty string.
const { intersect } = require('semver-range-intersect')
intersect('x.x.x') === ''
intersect('*') === ''
intersect('') === ''
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.