is-resolvable

WebJar for is-resolvable

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

is-resolvable
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

is-resolvable
WebJar for is-resolvable
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/shinnn/is-resolvable

Download is-resolvable

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/is-resolvable/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>is-resolvable</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/is-resolvable/
implementation 'org.webjars.npm:is-resolvable:1.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/is-resolvable/
implementation ("org.webjars.npm:is-resolvable:1.1.0")
'org.webjars.npm:is-resolvable:jar:1.1.0'
<dependency org="org.webjars.npm" name="is-resolvable" rev="1.1.0">
  <artifact name="is-resolvable" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='is-resolvable', version='1.1.0')
)
libraryDependencies += "org.webjars.npm" % "is-resolvable" % "1.1.0"
[org.webjars.npm/is-resolvable "1.1.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

is-resolvable

npm version 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

Versions

Version
1.1.0
1.0.0