Bump to v3.6.0.

This commit is contained in:
jdalton
2015-03-24 19:28:36 -07:00
parent ee1f12c851
commit 801ffd8adf
193 changed files with 1213 additions and 976 deletions

View File

@@ -1,4 +1,5 @@
import isError from '../lang/isError';
import restParam from '../function/restParam';
/**
* Attempts to invoke `func`, returning either the result or the caught error
@@ -7,7 +8,7 @@ import isError from '../lang/isError';
* @static
* @memberOf _
* @category Utility
* @param {*} func The function to attempt.
* @param {Function} func The function to attempt.
* @returns {*} Returns the `func` result or error object.
* @example
*
@@ -20,19 +21,12 @@ import isError from '../lang/isError';
* elements = [];
* }
*/
function attempt() {
var func = arguments[0],
length = arguments.length,
args = Array(length ? (length - 1) : 0);
while (--length > 0) {
args[length - 1] = arguments[length];
}
var attempt = restParam(function(func, args) {
try {
return func.apply(undefined, args);
} catch(e) {
return isError(e) ? e : new Error(e);
}
}
});
export default attempt;