npm-searcher

1.0.7 • Public • Published

npm-searcher

npm-searcher package
  • NPM package that gets information about npm packages and other info from the NPM API

Installation from NPM

npm i npm-searcher
  • search(package_name) - Get a npm package
    • package_name: (REQUIRED) npm package name

Examples

(Using await)

const npm = require('npm-searcher')

async function getNpm() {
    const res = await npm.search('express')
    console.log(res) // All information related to the express package
    console.log(res.name) // express
}
getNpm()

(Using .then function)

const npm = require('npm-searcher')

npm.search('express').then(res => {
    console.log(res) // All information related to the express package
    console.log(res.name) // express
})

(Validation)

const npm = require('npm-searcher')

npm.search('express').then(res => {
    if (res) {
        console.log(res) // All information related to the express package
        console.log(res.name) // express
    } else {
        console.log("package not found");
    }
})

Contributing

© npm-searcher, 2021 | abdooo9 (abdooo9.dev@gmail.com)

Package Sidebar

Install

npm i npm-searcher

Weekly Downloads

6

Version

1.0.7

License

MIT

Unpacked Size

3.66 kB

Total Files

4

Last publish

Collaborators

  • abdooo9