spdx-expression-parse
Advanced tools
Comparing version 3.0.1 to 4.0.0
{ | ||
"name": "spdx-expression-parse", | ||
"description": "parse SPDX license expressions", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (https://kemitchell.com)", | ||
@@ -6,0 +6,0 @@ "files": [ |
@@ -50,2 +50,3 @@ This package parses [SPDX license expression](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) strings describing license terms, like [package.json license strings](https://docs.npmjs.com/files/package.json#license), into consistently structured ECMAScript objects. The npm command-line interface depends on this package, as do many automatic license-audit tools. | ||
.concat(require('spdx-license-ids/deprecated')) | ||
.filter(function (id) { return id[id.length - 1] !== '+' }) | ||
@@ -92,2 +93,15 @@ identifiers.forEach(function (id) { | ||
This package differs slightly from the SPDX standard in allowing lower- and mixed-case `AND`, `OR`, and `WITH` operators: | ||
```javascript | ||
assert.deepEqual( | ||
parse('MIT or BSD-2-Clause'), | ||
{ left: { license: 'MIT' }, conjunction: 'or', right: { license: 'BSD-2-Clause' } } | ||
) | ||
assert.deepEqual( | ||
parse('GPL-2.0 with GCC-exception-2.0'), | ||
{ license: 'GPL-2.0', exception: 'GCC-exception-2.0' } | ||
) | ||
``` | ||
The Linux Foundation and its contributors license the SPDX standard under the terms of [the Creative Commons Attribution License 3.0 Unported (SPDX: "CC-BY-3.0")](http://spdx.org/licenses/CC-BY-3.0). "SPDX" is a United States federally registered trademark of the Linux Foundation. The authors of this package license their work under the terms of the MIT License. |
@@ -40,3 +40,3 @@ 'use strict' | ||
var string | ||
var possibilities = ['WITH', 'AND', 'OR', '(', ')', ':', '+'] | ||
var possibilities = [/^WITH/i, /^AND/i, /^OR/i, '(', ')', ':', '+'] | ||
for (var i = 0; i < possibilities.length; i++) { | ||
@@ -55,3 +55,3 @@ string = read(possibilities[i]) | ||
type: 'OPERATOR', | ||
string: string | ||
string: string.toUpperCase() | ||
} | ||
@@ -58,0 +58,0 @@ } |
12336
106