require-implementation
Package that helps you to be okay if some dependency is missing.
Usage
const impl = try // Let the user know what action you would like to take. const math = // ... then require what ever package could // installed immediatly. catch e // You can filter other errors by checking for the code ecode === 'EPACKAGEMISSING' // In recommended packages erecommendedPackages == 'math' emessage === 'EPACKAGEMISSING: Trying to do some math.\n'+ 'This error can be easily fixed by running the following command:\n'+ '$ npm install --save math'
In case there are multiple options:
const impl = try // requireFirst lets people know that each of the const mathSet = // You can find out which was ldaded by taking the name mathSetname === 'math' || mathSetname === 'mathjs' // The required package can be found in .pkg const math = mathSetpkg catch e // Same error as above
License
ISC