Skip to content

Commit

Permalink
axios#4998 Simplify named export. Fix restricted access in strict mod…
Browse files Browse the repository at this point in the history
…e to the 'caller', 'callee', and 'arguments' properties. TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode.
  • Loading branch information
Romick2005 committed Oct 18, 2022
1 parent 9bd5321 commit 481dab4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
15 changes: 1 addition & 14 deletions index.js
Expand Up @@ -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,
Expand All @@ -17,16 +17,3 @@ const {
} = axios;

export default axios;
export {
Axios,
AxiosError,
CanceledError,
isCancel,
CancelToken,
VERSION,
all,
Cancel,
isAxiosError,
spread,
toFormData
}
7 changes: 6 additions & 1 deletion lib/utils.js
Expand Up @@ -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;
}
});
Expand Down

1 comment on commit 481dab4

@Victorvikson1996
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arit

Please sign in to comment.