-
Notifications
You must be signed in to change notification settings - Fork 509
/
Copy pathcomparator-intersection.js
42 lines (42 loc) · 1.27 KB
/
comparator-intersection.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// c0, c1, expected intersection, includePrerelease
module.exports = [
// One is a Version
['1.3.0', '>=1.3.0', true],
['1.3.0', '>1.3.0', false],
['>=1.3.0', '1.3.0', true],
['>1.3.0', '1.3.0', false],
// Same direction increasing
['>1.3.0', '>1.2.0', true],
['>1.2.0', '>1.3.0', true],
['>=1.2.0', '>1.3.0', true],
['>1.2.0', '>=1.3.0', true],
// Same direction decreasing
['<1.3.0', '<1.2.0', true],
['<1.2.0', '<1.3.0', true],
['<=1.2.0', '<1.3.0', true],
['<1.2.0', '<=1.3.0', true],
// Different directions, same semver and inclusive operator
['>=1.3.0', '<=1.3.0', true],
['>=v1.3.0', '<=1.3.0', true],
['>=1.3.0', '>=1.3.0', true],
['<=1.3.0', '<=1.3.0', true],
['<=1.3.0', '<=v1.3.0', true],
['>1.3.0', '<=1.3.0', false],
['>=1.3.0', '<1.3.0', false],
// Opposite matching directions
['>1.0.0', '<2.0.0', true],
['>=1.0.0', '<2.0.0', true],
['>=1.0.0', '<=2.0.0', true],
['>1.0.0', '<=2.0.0', true],
['<=2.0.0', '>1.0.0', true],
['<=1.0.0', '>=2.0.0', false],
['', '', true],
['', '>1.0.0', true],
['<=2.0.0', '', true],
['<0.0.0', '<0.1.0', false],
['<0.1.0', '<0.0.0', false],
['<0.0.0-0', '<0.1.0', false],
['<0.1.0', '<0.0.0-0', false],
['<0.0.0-0', '<0.1.0', false, true],
['<0.1.0', '<0.0.0-0', false, true],
]