mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Remove baseSlice from _.attempt.
This commit is contained in:
@@ -10514,9 +10514,16 @@
|
|||||||
* elements = [];
|
* elements = [];
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
function attempt(func) {
|
function attempt() {
|
||||||
|
var length = arguments.length,
|
||||||
|
func = arguments[0];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return func.apply(undefined, baseSlice(arguments, 1));
|
var args = Array(length ? length - 1 : 0);
|
||||||
|
while (--length > 0) {
|
||||||
|
args[length - 1] = arguments[length];
|
||||||
|
}
|
||||||
|
return func.apply(undefined, args);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
return isError(e) ? e : new Error(e);
|
return isError(e) ? e : new Error(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user