From d6bcd62e4b2c54cd79b854e7b8e24eb48772e1de Mon Sep 17 00:00:00 2001 From: Colin Timmermans Date: Wed, 28 Oct 2015 11:25:40 +0100 Subject: [PATCH] Don't call slice on arguments Calling slice on arguments can prevent optimizations in some JS engines (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments). --- lib/axios.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/axios.js b/lib/axios.js index 5c2727a..53ba660 100644 --- a/lib/axios.js +++ b/lib/axios.js @@ -105,6 +105,10 @@ axios.interceptors = defaultInstance.interceptors; // Helpers function bind (fn, thisArg) { return function () { - return fn.apply(thisArg, Array.prototype.slice.call(arguments)); + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + return fn.apply(thisArg, args); }; }