lhl 6ff0e96ad3 8-4-1 | 1 year ago | |
---|---|---|
.. | ||
src | 1 year ago | |
CHANGELOG.md | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago | |
package.json | 1 year ago |
A function that tries to execute a function and discards any error that occurs.
npm install nice-try
const niceTry = require('nice-try')
niceTry(() => JSON.parse('true')) // true
niceTry(() => JSON.parse('truee')) // undefined
niceTry() // undefined
niceTry(true) // undefined
fn
{Function}
Function that might or might not throw an error.{?*}
Return-value of the function when no error occurred.