blob: 837506f2cc2db3718ebf774992e68d3dafa77c61 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001'use strict'
2
3/**
4 * Tries to execute a function and discards any error that occurs.
5 * @param {Function} fn - Function that might or might not throw an error.
6 * @returns {?*} Return-value of the function when no error occurred.
7 */
8module.exports = function(fn) {
9
10 try { return fn() } catch (e) {}
11
12}