Move more code out of the try-block in _.attempt.

This commit is contained in:
jdalton
2015-03-03 09:18:48 -08:00
parent b1366696c4
commit 3c99ecda60

View File

@@ -10676,14 +10676,14 @@
* }
*/
function attempt() {
var length = arguments.length,
func = arguments[0];
var func = arguments[0],
length = arguments.length,
args = Array(length ? length - 1 : 0);
while (--length > 0) {
args[length - 1] = arguments[length];
}
try {
var args = Array(length ? length - 1 : 0);
while (--length > 0) {
args[length - 1] = arguments[length];
}
return func.apply(undefined, args);
} catch(e) {
return isError(e) ? e : new Error(e);