Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.js « src « nice-try « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 837506f2cc2db3718ebf774992e68d3dafa77c61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
'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) {}

}