Check spdx license expressions
npm install @nodesecure/licenses-conformancebash
$ npm i @nodesecure/licenses-conformance
or
$ yarn add @nodesecure/licenses-conformance
`
Usage example
`js
import { licenseIdConformance } from "@nodesecure/licenses-conformance";
const result = licenseIdConformance("MIT");
if (result.ok) {
console.log(result.value);
}
/*
{
uniqueLicenseIds: ["MIT"],
spdxLicenseLinks: ["https://spdx.org/licenses/MIT.html#licenseText"],
spdx: {
osi: true,
fsf: true,
fsfAndOsi: true,
includesDeprecated: false
}
}
*/
`
API
`ts
interface spdxLicenseConformance {
uniqueLicenseIds: string[];
spdxLicenseLinks: string[];
spdx?: {
osi: boolean;
fsf: boolean;
fsfAndOsi: boolean;
includesDeprecated: boolean;
};
}
function licenseIdConformance(
licenseID: string
): { ok: true, value: spdxLicenseConformance } | { ok: false, value: Error };
function searchSpdxLicenseId(contentStr: string): string | null;
`
Updating SPDX licenses
To update the src/spdx.json file just run the following npm script:
`bash
$ npm run spdx:refresh
``
Vincent Dhennin 💻 🐛 📖 |
Gentilhomme 💻 👀 🛡️ |
Kouadio Fabrice Nguessan 🚧 |