Socket
Socket
Sign inDemoInstall

validate-npm-package-license

Package Overview
Dependencies
2
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    validate-npm-package-license

Give me a string and I'll tell you if it's a valid npm package license


Version published
Weekly downloads
21M
decreased by-9.4%
Maintainers
1
Install size
57.6 kB
Created
Weekly downloads
 

Package description

What is validate-npm-package-license?

The validate-npm-package-license package is used to validate and parse license identifiers based on the SPDX license list. It helps ensure that package licenses are valid and SPDX-compliant, which is important for legal compliance and software distribution.

What are validate-npm-package-license's main functionalities?

License Validation

This feature allows you to validate a string to check if it's a valid SPDX license expression. The code sample demonstrates how to validate the 'MIT' license identifier.

"use strict";\nconst validate = require('validate-npm-package-license');\nconst result = validate('MIT');\nconsole.log(result);

License Parsing

This feature enables parsing of complex SPDX license expressions, such as dual licenses. The code sample shows how to parse and validate a compound license expression that includes both 'MIT' and 'Apache-2.0' licenses.

"use strict";\nconst validate = require('validate-npm-package-license');\nconst result = validate('(MIT OR Apache-2.0)');\nconsole.log(result);

Other packages similar to validate-npm-package-license

Readme

Source

npm-validate-package-license

Give me a string and I'll tell you if it's a valid npm package license.

This package is not endorsed or approved by npm. It is part of a proposal to add license field validation to the npm command-line interface.

var validResult = {
  validForNewPackages: true,
  validForOldPackages: true
};

valid('Apache-2.0'); // => validResult
valid('GPL-3.0 OR BSD-2-Clause'); // => validResult

var invalidResult = {
  validForOldPackages: false,
  validForNewPackages: false,
  warnings: [
    'license should be a valid SPDX license expression',
	'license is similar to the valid expression "Apache-2.0"'
  ]
};

valid('Apache 2.0'); // => invalidResult

Keywords

FAQs

Last updated on 03 May 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc