From 481dab47b546960d8ed2bc9942355cbf7d5c2127 Mon Sep 17 00:00:00 2001 From: Roman Melnyk Date: Tue, 18 Oct 2022 18:06:45 +0300 Subject: [PATCH] #4998 Simplify named export. Fix restricted access in strict mode to the 'caller', 'callee', and 'arguments' properties. TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode. --- index.js | 15 +-------------- lib/utils.js | 7 ++++++- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/index.js b/index.js index b5369d7842..c6f9a4bc97 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ import axios from './lib/axios.js'; // Keep top-level export same with static properties // so that it can keep same with es module or cjs -const { +export const { Axios, AxiosError, CanceledError, @@ -17,16 +17,3 @@ const { } = axios; export default axios; -export { - Axios, - AxiosError, - CanceledError, - isCancel, - CancelToken, - VERSION, - all, - Cancel, - isAxiosError, - spread, - toFormData -} diff --git a/lib/utils.js b/lib/utils.js index e075f9e2ab..0e34a75bfc 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -512,7 +512,12 @@ const reduceDescriptors = (obj, reducer) => { const reducedDescriptors = {}; forEach(descriptors, (descriptor, name) => { - if (reducer(descriptor, name, obj) !== false) { + if ( + name !== 'caller' && + name !== 'callee' && + name !== 'arguments' && + reducer(descriptor, name, obj) !== false + ) { reducedDescriptors[name] = descriptor; } });