mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-02 13:39:30 +08:00
12 lines
No EOL
303 B
Text
12 lines
No EOL
303 B
Text
'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) {}
|
|
|
|
} |