validate-npm-package-license
Give me a string and I'll tell you if it's a valid npm package license string.
var valid = ;
SPDX license identifiers are valid license strings:
var assert = ;var validSPDXExpression = validForNewPackages: true validForOldPackages: true spdx: true; assert;assert;assert;assert;
The function will return a warning and suggestion for nearly-correct license identifiers:
assert;
SPDX expressions are valid, too ...
// Simple SPDX license expression for dual licensingassert;
... except if they contain LicenseRef
:
var warningAboutLicenseRef = validForOldPackages: false validForNewPackages: false spdx: true warnings: 'license should be ' + 'a valid SPDX license expression (without "LicenseRef"), ' + '"UNLICENSED", or ' + '"SEE LICENSE IN <filename>"' ; assert; assert;
If you can't describe your licensing terms with standardized SPDX identifiers, put the terms in a file in the package and point users there:
assert; assert;
If there aren't any licensing terms, use UNLICENSED
:
var unlicensed = validForNewPackages: true validForOldPackages: true unlicensed: true;assert;assert;