PATH:
usr
/
local
/
lib
/
node_modules
/
bower
/
lib
/
node_modules
/
inquirer
/
node_modules
/
lodash
/
utility
var isError = require('../lang/isError'), restParam = require('../function/restParam'); /** * Attempts to invoke `func`, returning either the result or the caught error * object. Any additional arguments are provided to `func` when it's invoked. * * @static * @memberOf _ * @category Utility * @param {Function} func The function to attempt. * @returns {*} Returns the `func` result or error object. * @example * * // avoid throwing errors for invalid selectors * var elements = _.attempt(function(selector) { * return document.querySelectorAll(selector); * }, '>_>'); * * if (_.isError(elements)) { * elements = []; * } */ var attempt = restParam(function(func, args) { try { return func.apply(undefined, args); } catch(e) { return isError(e) ? e : new Error(e); } }); module.exports = attempt;
[-] iteratee.js
[edit]
[-] noop.js
[edit]
[-] method.js
[edit]
[+]
..
[-] callback.js
[edit]
[-] property.js
[edit]
[-] times.js
[edit]
[-] matchesProperty.js
[edit]
[-] propertyOf.js
[edit]
[-] attempt.js
[edit]
[-] range.js
[edit]
[-] identity.js
[edit]
[-] constant.js
[edit]
[-] matches.js
[edit]
[-] uniqueId.js
[edit]
[-] methodOf.js
[edit]
[-] mixin.js
[edit]