Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/npm-keyword
Get a list of npm packages with keywords
https://github.com/sindresorhus/npm-keyword
Last synced: 2 months ago
JSON representation
Get a list of npm packages with keywords
- Host: GitHub
- URL: https://github.com/sindresorhus/npm-keyword
- Owner: sindresorhus
- License: mit
- Created: 2015-01-18T16:45:38.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2024-02-26T04:04:48.000Z (10 months ago)
- Last Synced: 2024-04-13T17:54:34.976Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 38.1 KB
- Stars: 51
- Watchers: 6
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
- Security: .github/security.md
Awesome Lists containing this project
- awesome-npm - npm-keyword - Get a list of npm packages with a certain keyword. (Packages / Registry)
- awesome-npm - npm-keyword - Get a list of npm packages with a certain keyword. (Packages / Registry)
README
# npm-keyword
> Get a list of npm packages with keywords
## Install
```sh
npm install npm-keyword
```## Usage
```js
import {npmKeyword, npmKeywordNames, npmKeywordCount} from 'npm-keyword';console.log(await npmKeyword('gulpplugin'));
//=> [{name: 'gulp-autoprefixer', description: '…'}, …]console.log(await npmKeywordNames('gulpplugin'));
//=> ['gulp-autoprefixer', …]console.log(await npmKeywordCount('gulpplugin'));
//=> 3457
```## Caveat
The list of packages will contain a maximum of 250 packages matching the keywords. This limitation is caused by the [npm registry API](https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search).
## API
### npmKeyword(keywords, options?)
Returns a promise for a list of packages having the specified keyword in their package.json `keywords` property.
#### keywords
Type: `string | string[]`\
Example: `['string', 'camelcase']`One or more keywords. Only matches packages that have *all* the given keywords.
#### options
Type: `object`
##### size
Type: `number`\
Default: `250`Limits the amount of results.
### npmKeywordNames(keywords, options?)
Returns a promise for a list of package names.
#### keywords
Type: `string | string[]`\
Example: `['string', 'camelcase']`One or more keywords. Only matches packages that have *all* the given keywords.
#### options
Type: `object`
##### size
Type: `number`\
Default: `250`Limits the amount of results.
### npmKeywordCount(keywords)
Returns a promise for the count of packages.
#### keywords
Type: `string | string[]`\
Example: `['string', 'camelcase']`One or more keywords. Only matches packages that have *all* the given keywords.
## Related
- [package-json](https://github.com/sindresorhus/package-json) - Get the package.json of a package from the npm registry
- [npm-user](https://github.com/sindresorhus/npm-user) - Get user info of an npm user
- [npm-email](https://github.com/sindresorhus/npm-email) - Get the email of an npm user