From 6161947d9d3496ae75909a2ded98fa43ecb7e572 Mon Sep 17 00:00:00 2001 From: Noritaka Kobayashi Date: Sun, 6 Jul 2025 23:59:56 +0900 Subject: [PATCH] refactor: use spread operator instead of '.apply()' (#6938) Co-authored-by: Jay --- lib/core/Axios.js | 4 ++-- lib/helpers/throttle.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/Axios.js b/lib/core/Axios.js index cff383e..67ba0e7 100644 --- a/lib/core/Axios.js +++ b/lib/core/Axios.js @@ -153,8 +153,8 @@ class Axios { if (!synchronousRequestInterceptors) { const chain = [dispatchRequest.bind(this), undefined]; - chain.unshift.apply(chain, requestInterceptorChain); - chain.push.apply(chain, responseInterceptorChain); + chain.unshift(...requestInterceptorChain); + chain.push(...responseInterceptorChain); len = chain.length; promise = Promise.resolve(config); diff --git a/lib/helpers/throttle.js b/lib/helpers/throttle.js index e256272..73e263d 100644 --- a/lib/helpers/throttle.js +++ b/lib/helpers/throttle.js @@ -17,7 +17,7 @@ function throttle(fn, freq) { clearTimeout(timer); timer = null; } - fn.apply(null, args); + fn(...args); } const throttled = (...args) => {