Parse the closest package.json file (upwards and downwards the tree) and returns whether a package is a dependency or not.
Needed to check whether if a project has react-native as a dependency or not.
yarn add is-package-dep # or npm i is-package-dep --save
const isPackageDep = require('is-package-dep');
const isRNProject = isPackageDep('react-native'); // value will be either `true` or `false`
Returns a boolean value that holds whether the package is installed or not.
Type: string
The name of the package.
Type: string
Default: process.cwd()
Directory to start looking up for the package.json
file.
MIT © Lucas Bento
Thanks to Sindre Sorhus for read-pkg-up module.