licence
v1.0.6
Published
A library to list and retrieve open source license texts
Maintainers
Readme
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:
MITApache-2.0GPL-3.0BSD-2-ClauseBSD-3-ClauseISCUnlicenseMPL-2.0LGPL-3.0AGPL-3.0
