A library to list and retrieve open source license texts
npm install licencetypescript
import { listLicenses, getLicenseText } from 'licence';
`
$3
Use the [listLicenses]() function to get an array of all supported licenses:
`typescript
const licenses = listLicenses();
console.log(licenses);
// Output: ['MIT', 'Apache-2.0', 'GPL-3.0', ...]
`
$3
Use the [getLicenseText]() function to fetch the full text of a specific license:
`typescript
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`