Socket
Socket
Sign inDemoInstall

spdx-compare

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spdx-compare

compare SPDX license expressions


Version published
Maintainers
1
Created

What is spdx-compare?

The spdx-compare npm package is used to compare SPDX license identifiers. It helps in determining if two SPDX license identifiers are equivalent or if one is a subset of the other. This is particularly useful in license compliance and management scenarios.

What are spdx-compare's main functionalities?

Compare two SPDX license identifiers for equality

This feature allows you to compare two SPDX license identifiers to check if they are exactly the same. In this example, it compares 'MIT' with 'MIT' and returns true.

const spdxCompare = require('spdx-compare');

const license1 = 'MIT';
const license2 = 'MIT';

const areEqual = spdxCompare(license1, license2);
console.log(`Are the licenses equal? ${areEqual}`);

Compare two SPDX license identifiers for subset relationship

This feature allows you to check if one SPDX license identifier is a subset of another. In this example, it checks if 'MIT' is a subset of 'MIT OR Apache-2.0' and returns true.

const spdxCompare = require('spdx-compare');

const license1 = 'MIT';
const license2 = 'MIT OR Apache-2.0';

const isSubset = spdxCompare.subset(license1, license2);
console.log(`Is the first license a subset of the second? ${isSubset}`);

Other packages similar to spdx-compare

Keywords

FAQs

Package last updated on 07 Mar 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc