suppress
v1.0.0
Published
Wraps around a function and suppresses its errors.
Downloads
146
Maintainers
Readme
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'