# optional

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

Latest version **0.1.4** (published 2017-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install optional
pnpm add optional
yarn add optional
bun add optional
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2017-07-13 |
| First published | 2013-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Maintainers | segomos |
| Keywords | include, optional include, optional, require, exists |

## Links

- npm: https://www.npmjs.com/package/optional
- Repository: https://github.com/tony-o/node-optional
- Homepage: http://segomos.com/
- Issues: https://github.com/tony-o/node-optional/issues
- npm.io page: https://npm.io/package/optional

## Recent versions

- 0.1.4 (latest) — 2017-07-13
- 0.1.3 — 2015-02-26
- 0.1.2 — 2014-12-10
- 0.1.1 — 2014-12-09
- 0.1.0 — 2014-09-28
- 0.1.0-2 — 2013-03-19
- 0.1.0-1 — 2013-01-18

## 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

```javascript
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

---
_Source: https://npm.io/package/optional · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
