{"name":"spdx-expression-parse","description":"parse SPDX license expressions","version":"3.0.0","author":{"name":"Kyle E. Mitchell","email":"kyle@kemitchell.com","url":"http://kemitchell.com"},"files":["AUTHORS","index.js","parse.js","scan.js"],"dependencies":{"spdx-exceptions":"^2.1.0","spdx-license-ids":"^3.0.0"},"devDependencies":{"defence-cli":"^2.0.1","mocha":"^3.4.2","replace-require-self":"^1.0.0","standard":"^10.0.2"},"keywords":["SPDX","law","legal","license","metadata","package","package.json","standards"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/jslicense/spdx-expression-parse.js.git"},"scripts":{"lint":"standard","test:readme":"defence -i javascript README.md | replace-require-self | node","test:mocha":"mocha test/index.js","test":"npm run test:mocha && npm run test:readme"},"contributors":[{"name":"C. Scott Ananian","email":"cscott@cscott.net","url":"http://cscott.net"},{"name":"Kyle E. Mitchell","email":"kyle@kemitchell.com","url":"https://kemitchell.com"},{"name":"Shinnosuke Watanabe","email":"snnskwtnb@gmail.com"},{"name":"Antoine Motet","email":"antoine.motet@gmail.com"}],"gitHead":"063e2d555cc5aef6c433c7dce7c543894476bcb8","bugs":{"url":"https://github.com/jslicense/spdx-expression-parse.js/issues"},"homepage":"https://github.com/jslicense/spdx-expression-parse.js#readme","_id":"spdx-expression-parse@3.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"kemitchell","email":"kyle@kemitchell.com"},"dist":{"integrity":"sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==","shasum":"99e119b7a5da00e05491c9fa338b7904823b41d0","tarball":"http://registry-npm.ywwl.com/spdx-expression-parse/download/spdx-expression-parse-3.0.0.tgz","fileCount":7,"unpackedSize":11871,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCRSwfZY9fsjaOtlpy0Nhu0oWvoab3JphGDA1orVO90zQIhAIC3yktQrP5Rw6CCap//BukXTSPg3hl8YzQOoioxueVJ"}],"size":4460,"noattachment":false,"key":"/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz"},"maintainers":[{"name":"kemitchell","email":"kyle@kemitchell.com"},{"name":"motet-a","email":"antoine.motet@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/spdx-expression-parse_3.0.0_1519690458018_0.7153856255157998"},"_hasShrinkwrap":false,"readme":"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.\n\nIn a nutshell:\n\n```javascript\nvar parse = require('spdx-expression-parse')\nvar assert = require('assert')\n\nassert.deepEqual(\n  // Licensed under the terms of the Two-Clause BSD License.\n  parse('BSD-2-Clause'),\n  {license: 'BSD-2-Clause'}\n)\n\nassert.throws(function () {\n  // An invalid SPDX license expression.\n  // Should be `Apache-2.0`.\n  parse('Apache 2')\n})\n\nassert.deepEqual(\n  // Dual licensed under either:\n  // - LGPL 2.1\n  // - a combination of Three-Clause BSD and MIT\n  parse('(LGPL-2.1 OR BSD-3-Clause AND MIT)'),\n  {\n    left: {license: 'LGPL-2.1'},\n    conjunction: 'or',\n    right: {\n      left: {license: 'BSD-3-Clause'},\n      conjunction: 'and',\n      right: {license: 'MIT'}\n    }\n  }\n)\n```\n\nThe syntax comes from the [Software Package Data eXchange (SPDX)](https://spdx.org/), a standard from the [Linux Foundation](https://www.linuxfoundation.org) 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.\n\nThe 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:\n\n1.  The [license list](https://spdx.org/licenses), a mapping from specific string identifiers, like `Apache-2.0`, to standard form license texts and bolt-on license exceptions.  The [spdx-license-ids](https://www.npmjs.com/package/spdx-license-ids) and [spdx-exceptions](https://www.npmjs.com/package/spdx-exceptions) packages implement the license list.  `spdx-expression-parse` depends on and `require()`s them.\n\n    Any license identifier from the license list is a valid license expression:\n\n    ```javascript\n    var identifiers = []\n      .concat(require('spdx-license-ids'))\n      .concat(require('spdx-license-ids/deprecated'))\n      .filter(function (id) { return id[id.length - 1] !== '+' })\n\n    identifiers.forEach(function (id) {\n      assert.deepEqual(parse(id), {license: id})\n    })\n    ```\n\n    So is any license identifier `WITH` a standardized license exception:\n\n    ```javascript\n    identifiers.forEach(function (id) {\n      require('spdx-exceptions').forEach(function (e) {\n        assert.deepEqual(\n          parse(id + ' WITH ' + e),\n          {license: id, exception: e}\n        )\n      })\n    })\n    ```\n\n2.  The license expression language, for describing simple and complex license terms, like `MIT` for MIT-licensed and `(GPL-2.0 OR Apache-2.0)` for dual-licensing under GPL 2.0 and Apache 2.0.  `spdx-expression-parse` itself implements license expression language, exporting a parser.\n\n    ```javascript\n    assert.deepEqual(\n      // Licensed under a combination of:\n      // - the MIT License AND\n      // - a combination of:\n      //   - LGPL 2.1 (or a later version) AND\n      //   - Three-Clause BSD\n      parse('(MIT AND (LGPL-2.1+ AND BSD-3-Clause))'),\n      {\n        left: {license: 'MIT'},\n        conjunction: 'and',\n        right: {\n          left: {license: 'LGPL-2.1', plus: true},\n          conjunction: 'and',\n          right: {license: 'BSD-3-Clause'}\n        }\n      }\n    )\n    ```\n\nThis package differs slightly from the SPDX standard in allowing lower- and mixed-case `AND`, `OR`, and `WITH` operators:\n\n```javascript\nassert.deepEqual(\n  parse('MIT or BSD-2-Clause'),\n  { left: { license: 'MIT' }, conjunction: 'or', right: { license: 'BSD-2-Clause' } }\n)\nassert.deepEqual(\n  parse('GPL-2.0 with GCC-exception-2.0'),\n  { license: 'GPL-2.0', exception: 'GCC-exception-2.0' }\n)\n```\n\nThe 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.\n","publish_time":1519690458092,"_cnpm_publish_time":1519690458092,"dist-tags":{"latest":"5.0.0"}}