Tests if a package is available to be imported. Useful for checking if optional dependencies are installed.
npm install @cityssm/has-packagepackage.json file.
sh
npm install @cityssm/has-package
`
Usage
`javascript
import hasPackage from '@cityssm/has-package'
/*
* Test for an existing package
*/
let packageExists = await hasPackage('eslint')
console.log(packageExists)
// => true
/*
* Test for an nonexisting package
*/
packageExists = await hasPackage('@cityssm/non-existing-package')
console.log(packageExists)
// => false
``