Socket
Socket
Sign inDemoInstall

optional

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    optional

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


Version published
Weekly downloads
354K
decreased by-16.79%
Maintainers
1
Install size
3.28 kB
Created
Weekly downloads
 

Readme

Source

#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

Keywords

FAQs

Last updated on 13 Jul 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc