nice-try
Tries to execute a function and discards any error that occurs
Last updated 7 years ago by electerious .
MIT · Repository · Bugs · Original npm
$ cnpm install nice-try 
SYNC missed versions from official npm registry.

nice-try

Travis Build Status Coverage Status Dependencies Greenkeeper badge

A function that tries to execute a function and discards any error that occurs.

Install

npm install nice-try

Usage

const niceTry = require('nice-try')

niceTry(() => JSON.parse('true')) // true
niceTry(() => JSON.parse('truee')) // undefined
niceTry() // undefined
niceTry(true) // undefined

API

Parameters

  • fn {Function} Function that might or might not throw an error.

Returns

  • {?*} Return-value of the function when no error occurred.

Current Tags

  • 1.0.5                                ...           latest (7 years ago)

1 Versions

  • 1.0.5                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org