Skip to content

NodeJS module to let you optionally include modules (instead of 'require')

License

Notifications You must be signed in to change notification settings

tony-o/node-optional

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OPTIONAL

Node-optional allows you to optionally 'require' modules without surrounding everything with 'try/catch'. Usage and installation is easy and this module itself is very easy and straightforward to use.

Install

  npm install optional

Requirements

Nodejs v4.0.0 or later

Usage

var optional = require("./optional");

var express = optional("express");
var fs = optional("fs");

console.log("express: " + express);
console.log("fs: " + fs);

Output:

express: null
fs: [object Object]

Changelog

v0.1.0-2

  • Corrected bug when trying to optionally include relative paths

About

NodeJS module to let you optionally include modules (instead of 'require')

Resources

License

Stars

Watchers

Forks

Packages

No packages published