Giter Club home page Giter Club logo

npm-keyword's Introduction

npm-keyword

Get a list of npm packages with keywords

Install

npm install npm-keyword

Usage

import npmKeyword from 'npm-keyword';

console.log(await npmKeyword('gulpplugin'));
//=> [{name: 'gulp-autoprefixer', description: '…'}, …]

Caveat

The list of packages will contain a maximum of 250 packages matching the keywords. This limitation is caused by the npm registry API.

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.

npmKeyword.names(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.

npmKeyword.count(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 - Get the package.json of a package from the npm registry
  • npm-user - Get user info of an npm user
  • npm-email - Get the email of an npm user

npm-keyword's People

Contributors

bendingbender avatar eddiemonge avatar kevva avatar mischah avatar ntwb avatar richienb avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

npm-keyword's Issues

Need to update search endpoint

Hej,

the endpoint used by that module is returning timeout errors frequently and will be probably be retired soon.

This is the feedback I got from npm support regarding yeoman/yo#544.

Thanks for reaching out. I've reached out to our team. They are in the process of retiring all endpoints as there are performance issues and timeouts. Per our team, you could run the below curl command instead:

curl -XGET https://registry.npmjs.org/-/v1/search?text=keywords:yeoman-generator | json

For more information on the new search API, please go to:
https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md#get-v1search

Please let us know if there is anything else we can do for you. We’ll be here to help. Thank you.

Problem with the new endpoint is that the result set is limited to a maximum of 250 😞
That means for getting all yeoman generators (6984) we would need to call that endpoint almost 30 times 🙀

Maybe the npms.io API offers an alternative endpoint to get all results with just one request.

`.count` crashes for a non-existent keyword

Hi, while working at b12-archive/keyword-popularity#1 I noticed that npmKeyword.count() chokes on a keyword that doesn’t exist.

Here’s what my REPL shouts:

npmKeyword.count('äąâ')
// …after a while:
TypeError: Cannot read property 'value' of undefined
    at /node_modules/npm-keyword/index.js:64:19
    at /node_modules/npm-keyword/index.js:24:3
    at /node_modules/npm-keyword/node_modules/got/index.js:99:4
    at BufferStream.<anonymous> (/node_modules/npm-keyword/node_modules/got/node_modules/read-all-stream/index.js:64:3)
    at BufferStream.emit (events.js:129:20)
    at finishMaybe (/node_modules/npm-keyword/node_modules/got/node_modules/read-all-stream/node_modules/readable-stream/lib/_stream_writable.js:502:14)
    at afterWrite (/node_modules/npm-keyword/node_modules/got/node_modules/read-all-stream/node_modules/readable-stream/lib/_stream_writable.js:381:3)
    at afterTick (/node_modules/npm-keyword/node_modules/got/node_modules/read-all-stream/node_modules/readable-stream/node_modules/process-nextick-args/index.js:11:8)
    at process._tickDomainCallback (node.js:381:11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.