module-resolve
use the require.resolve to look up the location of a module but return true in case of finding or false in case of not finding
API
var resolve = require('module-resolve')
resolve(module:string) - verify module is installed
- module - can be the name of the module or the path
resolse.load(module:string) - require/load the module
- module - can be the name of the module or the path
Usage
var resolve = // `npm i express` // should return true// should return false// should return true // the same as `var express = require('express')`// instead throwing an error returns "undefined" if module is not installedvar express = resolve
Development
this projet has been set up with a precommit that forces you to follow a code style, no jshint issues and 100% of code coverage before commit
to run test
npm test
to run jshint
npm run jshint
to run code style
npm run code-style
to run check code coverage
npm run check-coverage
to open the code coverage report
npm run open-coverage