validate-npm-package-license
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
spdx-correct | 1.0.0-prerelease-3 | 2.17 kB | Apache-2.0 | prod | 1 |
spdx | 0.4.3 | 22.69 kB | Apache-2.0 | prod | 1 |
"Validate-npm-package-license" is a lightweight npm package that functions as a tool to validate the license string of your npm package. This package helps you ensure that the license terminology you're using aligns with necessary guidelines. It examines the given string and determines whether it's a valid npm package license string, judging it by the standards of the SPDX license identifiers.
To use the "validate-npm-package-license" in your project, you first have to install the package in your project by running npm install validate-npm-package-license
in the terminal. Once the package is installed, you can use it by requiring it in your code.
Below is an example of how to use the package:
var valid = require('validate-npm-package-license');
var assert = require('assert');
var validSPDXExpression = {
validForNewPackages: true,
validForOldPackages: true,
spdx: true
};
assert.deepEqual(valid('MIT'), validSPDXExpression); // testing with the 'MIT' license
This code will return true
if the license string is valid for both old and new packages and conforms to SPDX guidelines.
The primary source of documentation for validate-npm-package-license
is its README file on the official GitHub repository. This documentation gives a comprehensive overview about the package, its functionality, and how to use it effectively. It also provides code snippets to illustrate its proper use. All details regarding the package uses, functions, and example outputs are well defined for new and existing users.