npm.io
1.0.6 • Published 9 months ago

licence

Licence
MIT
Version
1.0.6
Deps
0
Size
100 kB
Vulns
0
Weekly
0

Licence Manager

A TypeScript library to list and retrieve open-source license texts.

Features

  • List Supported Licenses: Get an array of all supported open-source licenses.
  • Retrieve License Texts: Fetch the full text of a specific license by its name.
  • Error Handling: Gracefully handle unsupported license names with clear error messages.

Usage

Importing the Library

Import the library into your TypeScript or JavaScript project as follows:

import { listLicenses, getLicenseText } from 'licence';
Listing All Supported Licenses

Use the listLicenses function to get an array of all supported licenses:

const licenses = listLicenses();
console.log(licenses);
// Output: ['MIT', 'Apache-2.0', 'GPL-3.0', ...]
Retrieving a License Text

Use the getLicenseText function to fetch the full text of a specific license:

try {
  const mitLicenseText = getLicenseText('MIT');
  console.log(mitLicenseText);
} catch (error) {
  console.error(error.message);
}

Supported Licenses

The following open-source licenses are supported by this library:

  • MIT
  • Apache-2.0
  • GPL-3.0
  • BSD-2-Clause
  • BSD-3-Clause
  • ISC
  • Unlicense
  • MPL-2.0
  • LGPL-3.0
  • AGPL-3.0