diff --git a/README.md b/README.md index eb1ed4c..789f49b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,14 @@ `satisfies(SPDX license expression, array of approved licenses)` Approved licenses may be simple license identifiers like `MIT`, plus-ranges like `EPL-2.0+`, or licenses with exceptions like `Apache-2.0 WITH LLVM`. They may _not_ be compound expressions using `AND` or `OR`. + +```javascript +var assert = require('assert') +var satisfies = require('spdx-satisfies') + +assert(satisfies('MIT', ['MIT', 'ISC', 'BSD-2-Clause', 'Apache-2.0'])) +assert(satisfies('GPL-2.0 OR MIT', ['MIT'])) +assert(!satisfies('GPL-2.0 AND MIT', ['MIT'])) +assert(satisfies('GPL-3.0', ['GPL-2.0+'])) +assert(!satisfies('GPL-1.0', ['GPL-2.0+'])) +``` diff --git a/package.json b/package.json index 2280897..433f65c 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,8 @@ "spdx-ranges": "^2.0.0" }, "devDependencies": { + "defence-cli": "^3.0.1", + "replace-require-self": "^1.1.1", "standard": "^11.0.0" }, "keywords": [ @@ -32,7 +34,9 @@ "index.js" ], "scripts": { - "test": "node test.js", + "test": "npm run test:suite && npm run test:readme", + "test:suite": "node test.js", + "test:readme": "defence -i javascript README.md | replace-require-self | node", "lint": "standard" } }