suppress

1.0.0 • Public • Published

suppress

A Node.js module that wraps around a function and suppresses whatever errors it might throw.

When suppressing errors from functions that normally return a value, you can optionally specify a "fallback value" to be returned in the event of an error.

Installation

npm install suppress --save

Usage

const suppress = require('suppress')
 
function thrower () {
  throw new Error()
}
 
suppress(thrower)() // undefined
suppress(thrower, 'return if error')() // 'return if error'

Package Sidebar

Install

npm i suppress

Weekly Downloads

17

Version

1.0.0

License

MIT

Last publish

Collaborators

  • lamansky