You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
303 B
12 lines
303 B
'use strict' |
|
|
|
/** |
|
* Tries to execute a function and discards any error that occurs. |
|
* @param {Function} fn - Function that might or might not throw an error. |
|
* @returns {?*} Return-value of the function when no error occurred. |
|
*/ |
|
module.exports = function(fn) { |
|
|
|
try { return fn() } catch (e) {} |
|
|
|
} |