NodeJS module to let you optionally include modules (instead of 'require')
JavaScript
Latest commit c5b345c Feb 26, 2015 tony-o Update package.json
Failed to load latest commit information.
LICENSE Adding a LICENSE file Feb 23, 2015
README.md fixed relative path optionals Mar 19, 2013
optional.js Update optional.js Dec 9, 2014
package.json Update package.json Feb 26, 2015
test.js init Jan 18, 2013

README.md

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

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