MCPcopy Index your code
hub / github.com/npm/node-semver / subset

Function subset

ranges/subset.js:45–71  ·  view source on GitHub ↗
(sub, dom, options = {})

Source from the content-addressed store, hash-verified

43// - Else return true
44
45const subset = (sub, dom, options = {}) => {
46 if (sub === dom) {
47 return true
48 }
49
50 sub = new Range(sub, options)
51 dom = new Range(dom, options)
52 let sawNonNull = false
53
54 OUTER: for (const simpleSub of sub.set) {
55 for (const simpleDom of dom.set) {
56 const isSub = simpleSubset(simpleSub, simpleDom, options)
57 sawNonNull = sawNonNull || isSub !== null
58 if (isSub) {
59 continue OUTER
60 }
61 }
62 // the null set is a subset of everything, but null simple ranges in
63 // a complex range should be ignored. so if we saw a non-null range,
64 // then we know this isn't a subset, but if EVERY simple range was null,
65 // then it is a subset.
66 if (sawNonNull) {
67 return false
68 }
69 }
70 return true
71}
72
73const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]
74const minimumVersion = [new Comparator('>=0.0.0')]

Callers 2

subset.jsFile · 0.85
bench-subset.jsFile · 0.85

Calls 1

simpleSubsetFunction · 0.85

Tested by

no test coverage detected