1.1.0 • Published 7 years ago

is-resolvable v1.1.0

Weekly downloads
8,426,803
License
ISC
Repository
github
Last release
7 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-plus@ct-note/table@caneco/siema@rstacruz/pnpm@percent/percent-api-hooksgenerator-bootstrap-boilerplate-templatejesusdemoinstall-ischain_diggerstock-ticker-react-widgetsolregex2tingzi-vuepressutexercitationem@applaud/cssnano@astro-my/sign-request@alta-ng-timeago/hiamtanh-alta@bezael-challenge/innoit-date-format@carhoo/widget-dealers@cdevine49/react-numeric-input@devorso/dcountdown@darwishdev/dash-dev@contagt/metismenuverify-img-codevformlmq@hazyflame/vue-jitsi-meet@hproinformatica/functions@humanity.cash/types@evershop/evershop@graines-digitales/nice-handsome-button@inovando-boletos/boleto@liuweiheng19906666/lwh-demo2@leiyulf/gantt-task-react@lwh19906666/lwh-demo2@meysam213/react-leaflet@mblode/react-native-feather@kommunicate/kommunicate-chatbot-plugin@ikon-x/ckeditor5-custom-build-for-irrosoft@junvary/quasar-ui-qcascader@sak1sham/react-toc-highlight@sailshq/eslint@scion-scxml/eslint@refactorpro/pixi-virtual-joystick@oriduk/ckeditor5-rebuild-oriduk@oriduk/ckeditor5-rebuild-musicanote@southcn/ckeditor5-build-inline@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-reacthot-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-captchackeditor-5-imi-1ckeditor5-build-custom-strapickeditor5-custom-build-for-irrosoftckeditor5-strapi-msg
1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

8 years ago

1.0.0

10 years ago

0.0.0

10 years ago