try-import
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Try Import Travis CI Build Status

Try to import a module, returning undefined if failed.

NPM Badge

Install

npm install try-import

Usage

const tryImport = require("try-import");
 
tryImport("name");
//=> () => { ... }
 
tryImport.resolve("name");
//=> 'C:\Users\richi\Documents\GitHub\try-import\node_modules\name\src\index.js'

API

tryImport(name)

name

Type: string

The module to try to import.

tryImport.resolve(name)

name

Type: string

The module to try to resolve.

/try-import/

    Package Sidebar

    Install

    npm i try-import

    Weekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    3.43 kB

    Total Files

    6

    Last publish

    Collaborators

    • richienb