1.0.1 • Published 3 years ago
search-npm.js v1.0.1
search-npm.js
- NPM package that gets information about npm packages and other info from the NPM API
Installation from NPM
search-npm.js
new Searcher(package_name)
- Get a npm packagepackage_name
: (REQUIRED) npm package name
Examples
(Using await)
const npm = require('search-npm.js')
async function getNpm() {
const res = await new npm.Searcher('express')
console.log(res) // All information related to the express package
console.log(res.name) // express
}
getNpm()
(Using .then function)
const npm = require('search-npm.js')
new npm.Searcher('express').then(res => {
console.log(res) // All information related to the express package
console.log(res.name) // express
})
(Validation)
const npm = require('search-npm.js')
new npm.Searcher('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
© search-npm.js, 2021 | tsdon0001
Idea taken from npm-searcher