const isResolvable = require('is-resolvable');
isResolvable('fs'); //=> true
isResolvable('path'); //=> true
// When ./index.js exists
isResolvable('./index.js') //=> true
isResolvable('./index') //=> true
isResolvable('.') //=> true
npm install is-resolvable
const isResolvable = require('is-resolvable');
isResolvable(moduleId [, options])
const isResolvable = require('is-resolvable');
// When ./foo.json exists
isResolvable('./foo.json'); //=> true
isResolvable('./foo'); //=> true
isResolvable('./foo.js'); //=> false
// When `eslint` module is installed but `jshint` isn't
isResolvable('eslint'); //=> true
isResolvable('jshint'); //=> false
// When `lodash` module is installed
isResolvable('lodash/isObject'); //=> true
isResolvable('lodash/fp/reject.js'); //=> true
// When ./bar/baz.js exists
isResolvable('./baz.js'); //=> false
isResolvable('./baz.js', {paths: ['bar']}); //=> true