spdx-satisfies 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) spdx-satisfies.js contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a
6
+ copy of this software and associated documentation files (the "Software"),
7
+ to deal in the Software without restriction, including without limitation
8
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
+ and/or sell copies of the Software, and to permit persons to whom the
10
+ Software is furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included
13
+ in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21
+ OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -26,6 +26,15 @@ assert(satisfies(
26
26
  ))
27
27
 
28
28
  assert(satisfies('(MIT OR GPL-2.0)', '(ISC OR MIT)'))
29
+ assert(satisfies('(MIT AND GPL-2.0)', '(MIT AND GPL-2.0)'))
30
+ assert(satisfies('MIT AND GPL-2.0 AND ISC', 'MIT AND GPL-2.0 AND ISC'))
31
+ assert(satisfies('(MIT OR GPL-2.0) AND ISC', 'MIT AND ISC'))
32
+ assert(satisfies('MIT AND ISC', '(MIT OR GPL-2.0) AND ISC'))
33
+ assert(satisfies('(MIT OR Apache-2.0) AND (ISC OR GPL-2.0)', 'Apache-2.0 AND ISC'))
34
+ assert(satisfies('(MIT OR Apache-2.0) AND (ISC OR GPL-2.0)', 'Apache-2.0 OR ISC'))
29
35
  assert(satisfies('(MIT AND GPL-2.0)', '(MIT OR GPL-2.0)'))
36
+ assert(satisfies('(MIT AND GPL-2.0)', '(GPL-2.0 AND MIT)'))
30
37
  assert(!satisfies('(MIT AND GPL-2.0)', '(ISC OR GPL-2.0)'))
38
+ assert(!satisfies('MIT AND (GPL-2.0 OR ISC)', 'MIT'))
39
+ assert(!satisfies('(MIT OR Apache-2.0) AND (ISC OR GPL-2.0)', 'MIT'))
31
40
  ```
package/index.js CHANGED
@@ -60,7 +60,14 @@ var licensesAreCompatible = function (first, second) {
60
60
 
61
61
  var recurseLeftAndRight = function (first, second) {
62
62
  var firstConjunction = first.conjunction
63
- if (firstConjunction === 'and') {
63
+ var secondConjunction = second.conjunction
64
+
65
+ if (firstConjunction === 'and' && secondConjunction === 'and') {
66
+ return (
67
+ (recurse(first.left, second.left) && recurse(first.right, second.right)) ||
68
+ (recurse(first.left, second.right) && recurse(first.right, second.left))
69
+ )
70
+ } else if (firstConjunction === 'and') {
64
71
  return (
65
72
  recurse(first.left, second) &&
66
73
  recurse(first.right, second)
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "spdx-satisfies",
3
3
  "description": "test whether SPDX expressions satisfy licensing criteria",
4
- "version": "4.0.0",
4
+ "version": "4.0.1",
5
5
  "author": "Kyle E. Mitchell <kyle@kemitchell.com> (https://kemitchell.com)",
6
+ "contributors": [
7
+ "Kyle E. Mitchell <kyle@kemitchell.com> (https://kemitchell.com)",
8
+ "Dan Butvinik <butvinik@outlook.com>"
9
+ ],
6
10
  "dependencies": {
7
11
  "spdx-compare": "^1.0.0",
8
12
  "spdx-expression-parse": "^3.0.0",
package/test.log ADDED
@@ -0,0 +1,70 @@
1
+
2
+ > spdx-satisfies@4.0.0 test /home/kyle/spdx-satisfies.js
3
+ > defence -i javascript README.md | replace-require-self | node
4
+
5
+ first is {"left":{"license":"ISC"},"conjunction":"or","right":{"license":"MIT"}}
6
+ second is {"license":"MIT"}
7
+ first is {"left":{"license":"ISC"},"conjunction":"or","right":{"left":{"license":"MIT"},"conjunction":"or","right":{"license":"Zlib"}}}
8
+ second is {"license":"Zlib"}
9
+ first is {"left":{"license":"MIT"},"conjunction":"or","right":{"license":"Zlib"}}
10
+ second is {"license":"Zlib"}
11
+ first is {"left":{"license":"ISC"},"conjunction":"or","right":{"license":"MIT"}}
12
+ second is {"license":"GPL-3.0"}
13
+ first is {"left":{"license":"MIT"},"conjunction":"or","right":{"license":"GPL-2.0"}}
14
+ second is {"left":{"license":"ISC"},"conjunction":"or","right":{"license":"MIT"}}
15
+ first is {"left":{"license":"ISC"},"conjunction":"or","right":{"license":"MIT"}}
16
+ second is {"license":"MIT"}
17
+ first is {"left":{"license":"MIT"},"conjunction":"and","right":{"license":"GPL-2.0"}}
18
+ second is {"left":{"license":"MIT"},"conjunction":"and","right":{"license":"GPL-2.0"}}
19
+ first is {"left":{"license":"MIT"},"conjunction":"and","right":{"left":{"license":"GPL-2.0"},"conjunction":"and","right":{"license":"ISC"}}}
20
+ second is {"left":{"license":"MIT"},"conjunction":"and","right":{"left":{"license":"GPL-2.0"},"conjunction":"and","right":{"license":"ISC"}}}
21
+ first is {"left":{"license":"GPL-2.0"},"conjunction":"and","right":{"license":"ISC"}}
22
+ second is {"left":{"license":"GPL-2.0"},"conjunction":"and","right":{"license":"ISC"}}
23
+ first is {"left":{"left":{"license":"MIT"},"conjunction":"or","right":{"license":"GPL-2.0"}},"conjunction":"and","right":{"license":"ISC"}}
24
+ second is {"left":{"license":"MIT"},"conjunction":"and","right":{"license":"ISC"}}
25
+ first is {"left":{"license":"MIT"},"conjunction":"or","right":{"license":"GPL-2.0"}}
26
+ second is {"license":"MIT"}
27
+ first is {"left":{"license":"MIT"},"conjunction":"and","right":{"license":"ISC"}}
28
+ second is {"left":{"left":{"license":"MIT"},"conjunction":"or","right":{"license":"GPL-2.0"}},"conjunction":"and","right":{"license":"ISC"}}
29
+ first is {"left":{"license":"MIT"},"conjunction":"or","right":{"license":"GPL-2.0"}}
30
+ second is {"license":"MIT"}
31
+ first is {"left":{"left":{"license":"MIT"},"conjunction":"or","right":{"license":"Apache-2.0"}},"conjunction":"and","right":{"left":{"license":"ISC"},"conjunction":"or","right":{"license":"GPL-2.0"}}}
32
+ second is {"left":{"license":"Apache-2.0"},"conjunction":"and","right":{"license":"ISC"}}
33
+ first is {"left":{"license":"MIT"},"conjunction":"or","right":{"license":"Apache-2.0"}}
34
+ second is {"license":"Apache-2.0"}
35
+ first is {"left":{"license":"ISC"},"conjunction":"or","right":{"license":"GPL-2.0"}}
36
+ second is {"license":"ISC"}
37
+ first is {"left":{"left":{"license":"MIT"},"conjunction":"or","right":{"license":"Apache-2.0"}},"conjunction":"and","right":{"left":{"license":"ISC"},"conjunction":"or","right":{"license":"GPL-2.0"}}}
38
+ second is {"left":{"license":"Apache-2.0"},"conjunction":"or","right":{"license":"ISC"}}
39
+ first is {"left":{"license":"MIT"},"conjunction":"or","right":{"license":"Apache-2.0"}}
40
+ second is {"left":{"license":"Apache-2.0"},"conjunction":"or","right":{"license":"ISC"}}
41
+ first is {"left":{"license":"Apache-2.0"},"conjunction":"or","right":{"license":"ISC"}}
42
+ second is {"license":"MIT"}
43
+ first is {"left":{"license":"Apache-2.0"},"conjunction":"or","right":{"license":"ISC"}}
44
+ second is {"license":"Apache-2.0"}
45
+ first is {"left":{"license":"ISC"},"conjunction":"or","right":{"license":"GPL-2.0"}}
46
+ second is {"left":{"license":"Apache-2.0"},"conjunction":"or","right":{"license":"ISC"}}
47
+ first is {"left":{"license":"Apache-2.0"},"conjunction":"or","right":{"license":"ISC"}}
48
+ second is {"license":"ISC"}
49
+ first is {"left":{"license":"MIT"},"conjunction":"and","right":{"license":"GPL-2.0"}}
50
+ second is {"left":{"license":"MIT"},"conjunction":"or","right":{"license":"GPL-2.0"}}
51
+ first is {"left":{"license":"MIT"},"conjunction":"or","right":{"license":"GPL-2.0"}}
52
+ second is {"license":"MIT"}
53
+ first is {"left":{"license":"MIT"},"conjunction":"or","right":{"license":"GPL-2.0"}}
54
+ second is {"license":"GPL-2.0"}
55
+ first is {"left":{"license":"MIT"},"conjunction":"and","right":{"license":"GPL-2.0"}}
56
+ second is {"left":{"license":"GPL-2.0"},"conjunction":"and","right":{"license":"MIT"}}
57
+ first is {"left":{"license":"MIT"},"conjunction":"and","right":{"license":"GPL-2.0"}}
58
+ second is {"left":{"license":"ISC"},"conjunction":"or","right":{"license":"GPL-2.0"}}
59
+ first is {"left":{"license":"ISC"},"conjunction":"or","right":{"license":"GPL-2.0"}}
60
+ second is {"license":"MIT"}
61
+ first is {"left":{"license":"MIT"},"conjunction":"and","right":{"left":{"license":"GPL-2.0"},"conjunction":"or","right":{"license":"ISC"}}}
62
+ second is {"license":"MIT"}
63
+ first is {"left":{"license":"GPL-2.0"},"conjunction":"or","right":{"license":"ISC"}}
64
+ second is {"license":"MIT"}
65
+ first is {"left":{"left":{"license":"MIT"},"conjunction":"or","right":{"license":"Apache-2.0"}},"conjunction":"and","right":{"left":{"license":"ISC"},"conjunction":"or","right":{"license":"GPL-2.0"}}}
66
+ second is {"license":"MIT"}
67
+ first is {"left":{"license":"MIT"},"conjunction":"or","right":{"license":"Apache-2.0"}}
68
+ second is {"license":"MIT"}
69
+ first is {"left":{"license":"ISC"},"conjunction":"or","right":{"license":"GPL-2.0"}}
70
+ second is {"license":"MIT"}
package/LICENSE.md DELETED
@@ -1,9 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (c) 2015 Kyle E. Mitchell
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.