node-require-fallback

1.0.0 • Public • Published

node-require-fallback

Require another package in Node.js if your first choice doesn't exist.

Useful for development, where you want to use a local copy of your package, but it shouldn't break the application for your team, which is depending on a npm package.

Installation

npm install --save node-require-fallback

Node.js >= 6 is required for this package.

Example Usage

var requireIfExists = require('node-require-fallback');
 
var myModule = requireIfExists('./module1', 'module2', 'module3');

You can pass as many modules to requireIfExists as you want. The first one that can be found will be loaded, otherwise null will be returned.

/node-require-fallback/

    Package Sidebar

    Install

    npm i node-require-fallback

    Weekly Downloads

    99

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • fabiandev