Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/get-spdx-license-ids
Get an array of the list of SPDX license IDs from spdx.org
https://github.com/shinnn/get-spdx-license-ids
Last synced: 27 days ago
JSON representation
Get an array of the list of SPDX license IDs from spdx.org
- Host: GitHub
- URL: https://github.com/shinnn/get-spdx-license-ids
- Owner: shinnn
- License: isc
- Created: 2016-01-12T10:23:14.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-26T04:45:11.000Z (almost 7 years ago)
- Last Synced: 2024-09-23T10:19:17.697Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://spdx.org/licenses/
- Size: 118 KB
- Stars: 0
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# get-spdx-license-ids
[![npm version](https://img.shields.io/npm/v/get-spdx-license-ids.svg)](https://www.npmjs.com/package/get-spdx-license-ids)
[![Build Status](https://travis-ci.org/shinnn/get-spdx-license-ids.svg?branch=master)](https://travis-ci.org/shinnn/get-spdx-license-ids)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/get-spdx-license-ids.svg)](https://coveralls.io/github/shinnn/is-gist-starred?branch=master)A [Node.js](https://nodejs.org/) module to get an array of the latest [SPDX license](https://spdx.org/licenses/) identifiers from [spdx.org](https://spdx.org/)
```javascript
const getSpdxLicenseIds = require('get-spdx-license-ids');(async () => {
const ids = await getSpdxLicenseIds();
//=> ['0BSD', 'AAL', 'Abstyles', 'Adobe-2006', 'Adobe-Glyph', 'ADSL', 'AFL-1.1', 'AFL-1.2', ...]
})();
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).
```
npm install get-spdx-license-ids
```## API
```javascript
const getSpdxLicenseIds = require('get-spdx-license-ids');
```### getSpdxLicenseIds([*options*])
*options*: `Object` ([`request` options](https://github.com/request/request#requestoptions-callback) without `json` option that defaults to `true`)
Return: `Promise>`It retrieves an array of non-deprecated SPDX license identifiers from .
```javascript
(async () => {
const ids = await getSpdxLicenseIds();
ids.includes('MIT'); //=> true
ids.includes('ISC'); //=> trueids.includes('GPL-1.0'); //=> false
})
```### getSpdxLicenseIds.deprecated([*options*])
Retrieves deprecated IDs only.
```javascript
(async () => {
const deprecatedIds = await getSpdxLicenseIds.deprecated();
deprecatedIds.includes('MIT'); //=> false
deprecatedIds.includes('ISC'); //=> falsedeprecatedIds.includes('GPL-1.0'); //=> true
})();
```### getSpdxLicenseIds.all([*options*])
Retrieves both deprecated and non-deprecated IDs in a single array.
```javascript
(async () => {
const allIds = await getSpdxLicenseIds.all();
allIds.includes('MIT'); //=> true
allIds.includes('ISC'); //=> true
allIds.includes('GPL-1.0'); //=> false
})();
```### getSpdxLicenseIds.both([*options*])
Retrieves both deprecated and non-deprecated IDs in two separate arrays.
```javascript
(async () => {
const pair = await getSpdxLicenseIds.both();
pair.length; //=> 2const [valid, deprecated] = pair;
valid.includes('MIT'); //=> true
valid.includes('ISC'); //=> truevalid.includes('GPL-1.0'); //=> false
deprecated.includes('MIT'); //=> false
deprecated.includes('ISC'); //=> falsedeprecated.includes('GPL-1.0'); //=> true
})();
```## License
[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe