{"id":17472595,"url":"https://github.com/shinnn/package-license-types","last_synced_at":"2025-03-28T07:45:41.609Z","repository":{"id":22655496,"uuid":"25998634","full_name":"shinnn/package-license-types","owner":"shinnn","description":"Extract license types from package.json data","archived":false,"fork":false,"pushed_at":"2015-05-02T09:50:29.000Z","size":174,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T18:14:16.542Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shinnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-31T02:19:42.000Z","updated_at":"2015-12-11T09:19:42.000Z","dependencies_parsed_at":"2022-08-21T08:31:16.664Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/package-license-types","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fpackage-license-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fpackage-license-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fpackage-license-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fpackage-license-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/package-license-types/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991554,"owners_count":20706126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-18T17:28:31.810Z","updated_at":"2025-03-28T07:45:41.588Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# package-license-types\n\n[![NPM version](https://img.shields.io/npm/v/package-license-types.svg)](https://www.npmjs.com/package/package-license-types)\n[![Bower version](https://img.shields.io/bower/v/package-license-types.svg)](https://github.com/shinnn/package-license-types/releases)\n[![Build Status](https://img.shields.io/travis/shinnn/package-license-types.svg)](https://travis-ci.org/shinnn/package-license-types)\n[![Build status](https://ci.appveyor.com/api/projects/status/q2fudvpnd95hg5qe?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/package-license-types)\n[![Coverage Status](https://img.shields.io/coveralls/shinnn/package-license-types.svg?label=cov)](https://coveralls.io/r/shinnn/package-license-types)\n[![Dependency Status](https://img.shields.io/david/shinnn/package-license-types.svg?label=deps)](https://david-dm.org/shinnn/package-license-types)\n[![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)\n\nExtract license types from package data\n\n```javascript\nvar pkg = {\n  name: 'foo',\n  version: '1.0.0',\n  description: 'Lorem ipsum dolor sit amet',\n  repository: 'shinnn/foo',\n  author: 'Shinnosuke Watanabe',\n  licenses: [\n    'BSD-3-Clause',\n    {\n      type: 'MIT',\n      url: 'LICENSE.md'\n    }\n  ]\n};\n\npackageLicenseTypes(pkg); //=\u003e ['BSD-3-Clause', 'MIT']\n```\n\nIt 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).\n\n## Installation\n\n### Package managers\n\n#### [npm](https://www.npmjs.com/)\n\n```sh\nnpm install package-license-types\n```\n\n#### [bower](http://bower.io/)\n\n```sh\nbower install package-license-types\n```\n\n#### [Duo](http://duojs.org/)\n\n```javascript\nvar packageLicenseTypes = require('shinnn/package-license-types');\n```\n\n### Standalone\n\n[Download the script file directly](https://raw.githubusercontent.com/shinnn/package-license-types/master/package-license-types.js) and install the dependency.\n\n#### Dependency\n\n* [is-spdx-license-identifier](https://github.com/shinnn/is-spdx-license-identifier.js)\n\n## API\n\n### packageLicenseTypes(*packageData*)\n\n*packageData*: `Object`  \nReturn: `Array` of `String`\n\nIt returns an array of the [SPDX license](https://spdx.org/licenses/) identifiers specified in the `license` and `licenses` properties of its first argument.\n\n```javascript\nvar packageLicenseTypes = require('package-license-types');\n\nvar pkg = require('./package.json');\npackageLicenseTypes(pkg); //=\u003e ['MIT']\n```\n\n```javascript\npackageLicenseTypes({\n  licenses: [\n    'MIT',        // valid SPDX license identifier\n    'foo-bar-baz' // invalid\n  ]\n}); //=\u003e ['MIT']\n```\n\nIt returns an empty array when it cannot find any license types from data.\n\n```javascript\npackageLicenseTypes({\n  license: {\n    url: 'https://github.com/shinnn/package-license-types/blob/master/LICENSE'\n  }\n}); //=\u003e []\n```\n\n## License\n\nCopyright (c) 2014 - 2015 [Shinnosuke Watanabe](https://github.com/shinnn)\n\nLicensed under [the MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fpackage-license-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Fpackage-license-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fpackage-license-types/lists"}