Newer
Older
alert / js / node_modules / nice-try / src / index.js
@Réz István Réz István on 18 Nov 2021 303 bytes first commit
'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) {}

}