JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 177703
  • Score
    100M100P100Q163361F
  • License MIT

Allows you to optionally include modules without surrounding everything with 'try/catch'

Package Exports

  • optional

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (optional) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#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