1.1.0 • Published 6 years ago

is-resolvable v1.1.0

Weekly downloads
8,426,803
License
ISC
Repository
github
Last release
6 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-test1vue-compmentvideo-multi-uploader@graines-digitales/nice-handsome-buttonfluid-eslintfm-eslint@lwh19906666/lwh-demo2tingzi-vuepresstestapautexercitationemvformlmqvcloudcam-playkit-js-hlsverify-img-codewow.js-juzi@junvary/quasar-ui-qcascadereslint-plugin-aurelia-event-aggregatoreslint-nullish-coalescing@kommunicate/kommunicate-chatbot-plugineslint-webeslint-webpackfahad-redux-axios-midleware@leiyulf/gantt-task-react@liuweiheng19906666/lwh-demo2fenglin-uploader@hproinformatica/functions@humanity.cash/types@inovando-boletos/boleto@mblode/react-native-feather@meysam213/react-leafletflowable-bpmn-modelerfirst-app-lyfucigenerator-bootstrap-boilerplate-templateeslint-config-common-sense@refactorpro/pixi-virtual-joystick@sailshq/eslint@sak1sham/react-toc-highlight@rstacruz/pnpminstall-is@hazyflame/vue-jitsi-meet@ikon-x/ckeditor5-custom-build-for-irrosofteseeslint-browserifyeslint-bundledhot-zone-vue@percent/percent-api-hooks@oriduk/ckeditor5-rebuild-musicanote@oriduk/ckeditor5-rebuild-oriduk@southcn/ckeditor5-build-inline@shinnn/eslint-configjesusdemo@scion-scxml/eslint@tillschweneker/ckeditor5-build-strapi-wysiwyg-markdown@the91end/react-auth@stansaal/ckeditor5-custom-build@bezael-challenge/innoit-date-format@astro-my/sign-requestng-search-dropdown@caneco/siemaaxios-retry-anoaxios-yet-another-proxy-fix@zebracompany/f_editorlwh-demo1@contagt/metismenu@darwishdev/dash-dev@applaud/cssnanonka-gantt-task-reactbase-editorchain_digger@ct-note/tablenpm-all-packagesnplintm2m-chartjs-plugin-crosshairlitepie-datepicker-gabe@vue-helper/vue-keep-alivemggauhar@alta-ng-timeago/hiamtanh-altaapc-youtubeap-vue-captchaplaykit-js-hls-sondq@devorso/dcountdownomnisminusreact-lightbox-pack-18supportreact-native-handcheque-enginereact-native-dm-player
1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

9 years ago

0.0.0

9 years ago