Check if the node module has exists
$ npm install --save nm-exists
const nmExists = require('nm-exists');
// async
nmExists('fs').then(exists => {
console.log(exists);
//=> 'true'
});
// imagine `express` has been installed in `node_modules/express` directorie
nmExists('express').then(exists => {
console.log(exists);
//=> 'true'
});
// sync
nmExists.sync('path');
//=> 'true'
nmExists.sync('./unicorn');
//=> 'true'
Returns a promise for a boolean of whether the module exists
Returns a boolean of whether the module exists
Type: string
MIT © Guntur Poetra