spdx-license

Get SPDX license information

Usage no npm install needed!

<script type="module">
  import spdxLicense from 'https://cdn.skypack.dev/spdx-license';
</script>

README

spdx-license

npm typescript GitHub stars Twitter Follow

Get SPDX license information.

Uses cross-fetch-json to support usage in both brower and node.

Installation

yarn add spdx-license
npm install spdx-license

API

Types

import { getLicense, getLicenses, FullLicense, Licenses, License } from "spdx-license";

function getLicense(id: string): Promise<FullLicense | undefined>;

function getLicenses(): Promise<Licenses>;

type FullLicense = {
  id: string;
  name: string;
  url: string;
  isDeprecated: boolean;
  isOSIApproved: boolean;
  isFSFLibre?: boolean;
  text: string;
};

type Licenses = {
  [id: string]: License;
}

type License = {
  id: string;
  name: string;
  url: string;
  isDeprecated: boolean;
  isOSIApproved: boolean;
  isFSFLibre?: boolean;
  getText: () => Promise<string | undefined>;
}

Dependenciesdependencies


Dev DependenciesDavid


License license

MIT


Related Packages: