# package-license-types

> Extract license types from package.json data

Latest version **1.0.1** (published 2015-05-02) · 0 weekly downloads

## Install

```sh
npm install package-license-types
pnpm add package-license-types
yarn add package-license-types
bun add package-license-types
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-05-02 |
| First published | 2014-10-31 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | shinnn |
| Keywords | spdx, data, package, license, type, browser, client-side |

## Links

- npm: https://www.npmjs.com/package/package-license-types
- Repository: https://github.com/shinnn/package-license-types
- Homepage: https://github.com/shinnn/package-license-types#readme
- Issues: https://github.com/shinnn/package-license-types/issues
- npm.io page: https://npm.io/package/package-license-types

## Dependencies (1)

- [is-spdx-license-id](https://npm.io/package/is-spdx-license-id.md) ^1.0.0

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-05-02
- 1.0.0 — 2014-11-03
- 0.0.0 — 2014-10-31

## README

# package-license-types

[![NPM version](https://img.shields.io/npm/v/package-license-types.svg)](https://www.npmjs.com/package/package-license-types)
[![Bower version](https://img.shields.io/bower/v/package-license-types.svg)](https://github.com/shinnn/package-license-types/releases)
[![Build Status](https://img.shields.io/travis/shinnn/package-license-types.svg)](https://travis-ci.org/shinnn/package-license-types)
[![Build status](https://ci.appveyor.com/api/projects/status/q2fudvpnd95hg5qe?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/package-license-types)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/package-license-types.svg?label=cov)](https://coveralls.io/r/shinnn/package-license-types)
[![Dependency Status](https://img.shields.io/david/shinnn/package-license-types.svg?label=deps)](https://david-dm.org/shinnn/package-license-types)
[![devDependency Status](https://img.shields.io/david/dev/shinnn/package-license-types.svg?label=devDeps)](https://david-dm.org/shinnn/package-license-types#info=devDependencies)

Extract license types from package data

```javascript
var pkg = {
  name: 'foo',
  version: '1.0.0',
  description: 'Lorem ipsum dolor sit amet',
  repository: 'shinnn/foo',
  author: 'Shinnosuke Watanabe',
  licenses: [
    'BSD-3-Clause',
    {
      type: 'MIT',
      url: 'LICENSE.md'
    }
  ]
};

packageLicenseTypes(pkg); //=> ['BSD-3-Clause', 'MIT']
```

It supports [package.json](https://docs.npmjs.com/files/package.json), [bower.json](https://github.com/bower/bower.json-spec) and [component.json](https://github.com/componentjs/spec/blob/master/component.json/specifications.md).

## Installation

### Package managers

#### [npm](https://www.npmjs.com/)

```sh
npm install package-license-types
```

#### [bower](http://bower.io/)

```sh
bower install package-license-types
```

#### [Duo](http://duojs.org/)

```javascript
var packageLicenseTypes = require('shinnn/package-license-types');
```

### Standalone

[Download the script file directly](https://raw.githubusercontent.com/shinnn/package-license-types/master/package-license-types.js) and install the dependency.

#### Dependency

* [is-spdx-license-identifier](https://github.com/shinnn/is-spdx-license-identifier.js)

## API

### packageLicenseTypes(*packageData*)

*packageData*: `Object`  
Return: `Array` of `String`

It returns an array of the [SPDX license](https://spdx.org/licenses/) identifiers specified in the `license` and `licenses` properties of its first argument.

```javascript
var packageLicenseTypes = require('package-license-types');

var pkg = require('./package.json');
packageLicenseTypes(pkg); //=> ['MIT']
```

```javascript
packageLicenseTypes({
  licenses: [
    'MIT',        // valid SPDX license identifier
    'foo-bar-baz' // invalid
  ]
}); //=> ['MIT']
```

It returns an empty array when it cannot find any license types from data.

```javascript
packageLicenseTypes({
  license: {
    url: 'https://github.com/shinnn/package-license-types/blob/master/LICENSE'
  }
}); //=> []
```

## License

Copyright (c) 2014 - 2015 [Shinnosuke Watanabe](https://github.com/shinnn)

Licensed under [the MIT License](./LICENSE).

---
_Source: https://npm.io/package/package-license-types · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
