1.1.0 • Published 8 years ago

is-resolvable v1.1.0

Weekly downloads
8,426,803
License
ISC
Repository
github
Last release
8 years ago

is-resolvable

npm version Build Status Build status Coverage Status

A Node.js module to check if a given module ID is resolvable with require()

const isResolvable = require('is-resolvable');

isResolvable('fs'); //=> true
isResolvable('path'); //=> true

// When ./index.js exists
isResolvable('./index.js') //=> true
isResolvable('./index') //=> true
isResolvable('.') //=> true

Installation

Use npm.

npm install is-resolvable

API

const isResolvable = require('is-resolvable');

isResolvable(moduleId , options)

moduleId: string (module ID)
options: Object (require.resolve options)
Return: boolean

It returns true if require() can load a file form a given module ID, otherwise false.

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

The second argument accepts an options object for require.resolve().

// When ./bar/baz.js exists

isResolvable('./baz.js'); //=> false
isResolvable('./baz.js', {paths: ['bar']}); //=> true

License

ISC License © 2018 Shinnosuke Watanabe

vuedragdropuploadimageselectron-eslinteslint-4-fix@arisageha/react-lazyload@arisageha/react-lazyload-fixcloud-archive-s3bb-chat@fundefund/funde_ckagreestudioeslintgql_din_modmutasi-bcacthpb-plugin-socialukor-remaster@infinitebrahmanuniverse/nolb-is-r@everything-registry/sub-chunk-1934p149-tablevue-button-test1wow.js-juzisticky-scroll-catchtestapavue-compmentvcloudcam-playkit-js-hlsvideo-multi-uploadervs-tree-plusgenerator-bootstrap-boilerplate-templatejesusdemoinstall-ishot-zone-vuelitepie-datepicker-gabelwh-demo1m2m-chartjs-plugin-crosshairkrown_login_library@vue-helper/vue-keep-alive@tillschweneker/ckeditor5-build-strapi-wysiwyg-markdown@the91end/react-auth@zebracompany/f_editoraxios-retry-anoaxios-yet-another-proxy-fixapc-youtubeap-vue-captcha@graines-digitales/nice-handsome-button@contagt/metismenu@hazyflame/vue-jitsi-meetchain_diggerstock-ticker-react-widgetsolregex2tingzi-vuepressutexercitationem@astro-my/sign-requestverify-img-codevformlmq@liuweiheng19906666/lwh-demo2@leiyulf/gantt-task-react@stansaal/ckeditor5-custom-buildmggauharp147-tablep148-tablenplintomnisminusreact-native-dm-playerreact-native-handcheque-enginereact-lightbox-pack-18supportreact-gantt-chart7sequelcomponentnka-gantt-task-reactng-search-dropdownplaykit-js-hls-sondqresponsis-gantt-task-reactckeditor-5-imi-1ckeditor5-build-custom-strapickeditor5-custom-build-for-irrosoftckeditor5-strapi-msgckeditor5-custom-ksckeditor5-custom-symmetreckeditor5-custom-build-megampireckeditor5-build-yektackeditor5-click-virtualckeditor5-build-classic-ticketckeditor5-build-classic-v-editcourse-vue-tplcssesc-wbgcssnano-nightlybase-editordigital-keyboard-demos@shinnn/eslint-configeslint-nullish-coalescingeslint-plugin-aurelia-event-aggregatoreseeslint-browserifyeslint-bundledeslint-config-common-senseeslint-webeslint-webpackfenglin-uploaderfirst-app-lyfucifm-eslintfluid-eslintflowable-bpmn-modelerfahad-redux-axios-midleware@pakasa/duuka-checkout
1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

10 years ago

0.0.0

10 years ago