0.1.1 • Published 7 years ago
is-package-dep v0.1.1
Why
Needed to check whether if a project has react-native as a dependency or not.
Install
yarn add is-package-dep # or npm i is-package-dep --save
Usage
const isPackageDep = require('is-package-dep');
isPackageDep('react-native')
.then(() => {
// Package has `react-native` as a dependency
}).catch(err => {
// Package doesn't have `react-native` as a dependency
});
API
isPackageDep(packageName, options)
Returns a boolean value that holds whether the package is installed or not.
packageName
Type: string
The name of the package.
options
baseDir
Type: string
Default: process.cwd()
Directory to start looking up for the package.json
file.
License
MIT © Lucas Bento
Thanks to Sindre Sorhus for read-pkg-up module.