moduleExists
Checks if a node module may be included via require
.
Installation
NPM:
$ npm i @zzzzbov/module-exists --S
Yarn:
$ yarn add @zzzzbov/module-exists
Usage
const moduleExists = require('@zzzzbov/module-exists');
if (moduleExists('example')) {
const example = require('example');
}