What is spdx-correct?
The spdx-correct npm package is used to correct invalid SPDX license identifiers to valid ones. SPDX (Software Package Data Exchange) is a standard format for communicating the licensing information of software packages. The spdx-correct package takes a possibly incorrect SPDX expression and returns a corrected version that is valid according to the SPDX specification, if possible.
What are spdx-correct's main functionalities?
Correcting invalid SPDX license identifiers
This feature takes an invalid SPDX license identifier, such as 'Apache 2.0', and corrects it to a valid identifier, 'Apache-2.0'.
"use strict";
const spdxCorrect = require('spdx-correct');
const corrected = spdxCorrect('Apache 2.0');
console.log(corrected); // 'Apache-2.0'
Other packages similar to spdx-correct
spdx-expression-parse
This package parses valid SPDX license expressions, ensuring they conform to the SPDX specification. Unlike spdx-correct, it does not correct invalid expressions but rather parses and validates the structure of valid SPDX expressions.
spdx-license-ids
This package provides a list of SPDX license identifiers. It can be used to validate if a given license identifier is a valid SPDX identifier. It does not correct invalid identifiers but can be used to check validity against the list of known identifiers.
validate-npm-package-license
This package checks if a given license string is a valid npm package license string, which can be an SPDX license expression. It is similar to spdx-correct in that it deals with license validation, but it does not correct invalid identifiers.