package-license-types
Extract license types from package data
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' ; ; //=> ['BSD-3-Clause', 'MIT']
It supports package.json, bower.json and component.json.
Installation
Package managers
npm
npm install package-license-types
bower
bower install package-license-types
Duo
var packageLicenseTypes = ;
Standalone
Download the script file directly and install the dependency.
Dependency
API
packageLicenseTypes(packageData)
packageData: Object
Return: Array
of String
It returns an array of the SPDX license identifiers specified in the license
and licenses
properties of its first argument.
var packageLicenseTypes = ; var pkg = ;; //=> ['MIT']
; //=> ['MIT']
It returns an empty array when it cannot find any license types from data.
; //=> []
License
Copyright (c) 2014 - 2015 Shinnosuke Watanabe
Licensed under the MIT License.