pax_global_header00006660000000000000000000000064134316350350014515gustar00rootroot0000000000000052 comment=a7c4716bba138dcfdde306be2ad2c99e95877784 jslicense-spdx-expression-validate.js-1733812/000077500000000000000000000000001343163503500212415ustar00rootroot00000000000000jslicense-spdx-expression-validate.js-1733812/.travis.yml000066400000000000000000000001721343163503500233520ustar00rootroot00000000000000--- language: node_js node_js: - '0.10' - '0.11' - '0.12' - '4' - '5' - '6' sudo: false script: - npm test - npm run lint jslicense-spdx-expression-validate.js-1733812/LICENSE000066400000000000000000000020651343163503500222510ustar00rootroot00000000000000The MIT License Copyright (c) 2015 Kyle E. Mitchell 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: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 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. jslicense-spdx-expression-validate.js-1733812/README.md000066400000000000000000000024371343163503500225260ustar00rootroot00000000000000```javascript var assert = require('assert') var valid = require('spdx-expression-validate') ``` # Simple License Expressions ```javascript assert(!valid('Invalid-Identifier')) assert(valid('GPL-2.0')) assert(valid('GPL-2.0+')) assert(valid('LicenseRef-23')) assert(valid('LicenseRef-MIT-Style-1')) assert(valid('DocumentRef-spdx-tool-1.2:LicenseRef-MIT-Style-2')) ``` # Composite License Expressions ## Disjunctive `OR` Operator ```javascript assert(valid('(LGPL-2.1 OR MIT)')) assert(valid('(LGPL-2.1 OR MIT OR BSD-3-Clause)')) ``` ## Conjunctive `AND` Operator ```javascript assert(valid('(LGPL-2.1 AND MIT)')) assert(valid('(LGPL-2.1 AND MIT AND BSD-2-Clause)')) ``` ## Exception `WITH` Operator ```javascript assert(valid('(GPL-2.0+ WITH Bison-exception-2.2)')) ``` # Strict Whitespace Rules ```javascript assert(!valid('MIT ')) assert(!valid(' MIT')) assert(!valid('MIT AND BSD-3-Clause')) ``` --- [The Software Package Data Exchange (SPDX) specification](http://spdx.org) is the work of the [Linux Foundation](http://www.linuxfoundation.org) and its contributors, and is licensed 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. jslicense-spdx-expression-validate.js-1733812/index.js000066400000000000000000000006111343163503500227040ustar00rootroot00000000000000var parse = require('spdx-expression-parse') var containsRepeatedSpace = /\s{2,}/ module.exports = function spdxExpressionValidate (argument) { var fatString = ( argument.trim() !== argument || containsRepeatedSpace.test(argument) ) if (fatString) { return false } else { try { parse(argument) return true } catch (e) { return false } } } jslicense-spdx-expression-validate.js-1733812/package.json000066400000000000000000000014641343163503500235340ustar00rootroot00000000000000{ "name": "spdx-expression-validate", "description": "validate SPDX license expressions", "version": "2.0.0", "author": "Kyle E. Mitchell (http://kemitchell.com)", "files": [ "index.js" ], "dependencies": { "spdx-expression-parse": "^3.0.0" }, "devDependencies": { "defence-cli": "^2.0.1", "replace-require-self": "^1.0.0", "standard": "^12.0.1" }, "homepage": "https://github.com/kemitchell/spdx.js", "keywords": [ "SPDX", "law", "legal", "license", "metadata", "package", "package.json", "standards" ], "license": "(MIT AND CC-BY-3.0)", "repository": "kemitchell/spdx-expression-validate.js", "scripts": { "test": "defence -i javascript README.md | replace-require-self | node", "lint": "standard" } }