-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4aa7f81
commit 342bdad
Showing
3 changed files
with
32 additions
and
25 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var examples = require('./examples.json') | ||
function write (string) { process.stdout.write(string + '\n') } | ||
|
||
write('`satisfies(SPDX license expression, array of approved licenses)`') | ||
write('') | ||
|
||
write('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`.') | ||
write('') | ||
|
||
write('```javascript') | ||
write("var assert = require('assert')") | ||
write("var satisfies = require('spdx-satisfies')") | ||
write('') | ||
|
||
write('// True Examples') | ||
write('for (const [spdxExpression, arrayOfApproved] of [') | ||
write(examples.returnTrue.map(function (e) { return ' ' + JSON.stringify(e) }).join(',\n')) | ||
write(']) assert(satisfies(spdxExpression, arrayOfApproved))') | ||
write('') | ||
|
||
write('// False Examples') | ||
write('for (const [spdxExpression, arrayOfApproved] of [') | ||
write(examples.returnFalse.map(function (e) { return ' ' + JSON.stringify(e) }).join(',\n')) | ||
write(']) assert(!satisfies(spdxExpression, arrayOfApproved))') | ||
write('') | ||
|
||
write('// Exceptions') | ||
write('for (const [spdxExpression, arrayOfApproved] of [') | ||
write(examples.throwErrors.map(function (e) { return ' ' + JSON.stringify(e) }).join(',\n')) | ||
write(']) assert.throws(function () { satisfies(spdxExpression, arrayOfApproved) })') | ||
write('```') |