This package parses SPDX license expression strings describing license terms, like package.json license strings, into consistently structured ECMAScript objects. The npm command-line interface depends on this package, as do many automatic license-audit tools.
In a nutshell:
var parse =var assert =assertassertassert
The syntax comes from the Software Package Data eXchange (SPDX), a standard from the Linux Foundation for shareable data about software package license terms. SPDX aims to make sharing and auditing license data easy, especially for users of open-source software.
The bulk of the SPDX standard describes syntax and semantics of XML metadata files. This package implements two lightweight, plain-text components of that larger standard:
The license list, a mapping from specific string identifiers, like
Apache-2.0, to standard form license texts and bolt-on license exceptions. The spdx-license-ids and spdx-exceptions packages implement the license list.
spdx-expression-parsedepends on and
Any license identifier from the license list is a valid license expression:var identifiers =identifiers
So is any license identifier
WITHa standardized license exception:identifiers
The license expression language, for describing simple and complex license terms, like
MITfor MIT-licensed and
(GPL-2.0 OR Apache-2.0)for dual-licensing under GPL 2.0 and Apache 2.0.
spdx-expression-parseitself implements license expression language, exporting a parser.assert
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"). "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.