Package Exports
- spdx
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (spdx) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
spdx.js
SPDX License Expression Syntax parser
Usage
Simple License Expressions
spdx.valid('GPL-2.0'); // => true
spdx.valid('GPL-2.0+'); // => true
spdx.valid('LicenseRef-23'); // => true
spdx.valid('LicenseRef-MIT-Style-1'); // => true
Composite License Expressions
Disjunctive OR
Operator
spdx.valid('(LGPL-2.1 OR MIT)'); // => true
spdx.valid('(LGPL-2.1 OR MIT OR BSD-3-Clause)'); // => true
Conjunctive AND
Operator
spdx.valid('(LGPL-2.1 AND MIT)'); // => true
spdx.valid('(LGPL-2.1 AND MIT AND BSD-2-Clause)'); // => true
Exception WITH
Clause
spdx.valid('(GPL-2.0+ WITH Bison-exception-2.2)'); // => true
Order of Precedence and Parentheses
spdx.valid('(LGPL-2.1 OR BSD-3-Clause AND MIT)'); // => true
spdx.valid('((LGPL-2.1+ OR BSD-3-Clause) AND MIT)'); // => true
spdx.valid('((LGPL-2.1+ OR BSD-3-Clause) AND MIT)'); // => true
Identifier Lists
Array.isArray(spdx.licenses); // => true
spdx.licenses.indexOf('ISC') > -1; // => true
spdx.licenses.indexOf('Apache-1.7') > -1; // => false
spdx.licenses.every(function(element) {
return typeof element === 'string';
}); // => true
Array.isArray(spdx.exceptions); // => true
spdx.exceptions.indexOf('GCC-exception-3.1') > -1; // => true
spdx.exceptions.every(function(element) {
return typeof element === 'string';
}); // => true
Version Metadata
typeof spdx.licenseListVersion === 'string'; // => true
typeof spdx.specificationVersion === 'string'; // => true
typeof spdx.version === 'string'; // => true