Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

spdx-satisfies

kemitchell3.4mMIT6.0.0TypeScript support: definitely-typed

test whether SPDX expressions satisfy licensing criteria

SPDX, law, legal, license, metadata, package, package.json, standards

readme

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.

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+']))