axios 1.0.0-alpha.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

Files changed (70) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/README.md +59 -48
  3. package/SECURITY.md +3 -2
  4. package/bin/ssl_hotfix.js +1 -1
  5. package/dist/axios.js +1552 -975
  6. package/dist/axios.js.map +1 -1
  7. package/dist/axios.min.js +1 -1
  8. package/dist/axios.min.js.map +1 -1
  9. package/dist/esm/axios.js +1471 -865
  10. package/dist/esm/axios.js.map +1 -1
  11. package/dist/esm/axios.min.js +1 -1
  12. package/dist/esm/axios.min.js.map +1 -1
  13. package/dist/node/axios.cjs +3750 -0
  14. package/dist/node/axios.cjs.map +1 -0
  15. package/gulpfile.js +88 -0
  16. package/index.d.ts +208 -63
  17. package/index.js +2 -1
  18. package/karma.conf.cjs +250 -0
  19. package/lib/adapters/http.js +251 -131
  20. package/lib/adapters/index.js +33 -0
  21. package/lib/adapters/xhr.js +79 -56
  22. package/lib/axios.js +33 -25
  23. package/lib/cancel/CancelToken.js +91 -88
  24. package/lib/cancel/CanceledError.js +5 -4
  25. package/lib/cancel/isCancel.js +2 -2
  26. package/lib/core/Axios.js +127 -100
  27. package/lib/core/AxiosError.js +10 -7
  28. package/lib/core/AxiosHeaders.js +274 -0
  29. package/lib/core/InterceptorManager.js +61 -53
  30. package/lib/core/buildFullPath.js +5 -4
  31. package/lib/core/dispatchRequest.js +21 -39
  32. package/lib/core/mergeConfig.js +8 -7
  33. package/lib/core/settle.js +6 -4
  34. package/lib/core/transformData.js +15 -10
  35. package/lib/defaults/index.js +46 -39
  36. package/lib/defaults/transitional.js +1 -1
  37. package/lib/env/classes/FormData.js +2 -2
  38. package/lib/env/data.js +1 -3
  39. package/lib/helpers/AxiosTransformStream.js +191 -0
  40. package/lib/helpers/AxiosURLSearchParams.js +23 -7
  41. package/lib/helpers/bind.js +2 -2
  42. package/lib/helpers/buildURL.js +16 -7
  43. package/lib/helpers/combineURLs.js +3 -2
  44. package/lib/helpers/cookies.js +43 -44
  45. package/lib/helpers/deprecatedMethod.js +4 -2
  46. package/lib/helpers/formDataToJSON.js +36 -15
  47. package/lib/helpers/fromDataURI.js +15 -13
  48. package/lib/helpers/isAbsoluteURL.js +3 -2
  49. package/lib/helpers/isAxiosError.js +4 -3
  50. package/lib/helpers/isURLSameOrigin.js +55 -56
  51. package/lib/helpers/null.js +1 -1
  52. package/lib/helpers/parseHeaders.js +24 -22
  53. package/lib/helpers/parseProtocol.js +3 -3
  54. package/lib/helpers/speedometer.js +55 -0
  55. package/lib/helpers/spread.js +3 -2
  56. package/lib/helpers/throttle.js +33 -0
  57. package/lib/helpers/toFormData.js +68 -18
  58. package/lib/helpers/toURLEncodedForm.js +5 -5
  59. package/lib/helpers/validator.js +20 -15
  60. package/lib/platform/browser/classes/FormData.js +1 -1
  61. package/lib/platform/browser/classes/URLSearchParams.js +2 -3
  62. package/lib/platform/browser/index.js +38 -6
  63. package/lib/platform/index.js +2 -2
  64. package/lib/platform/node/classes/FormData.js +2 -2
  65. package/lib/platform/node/classes/URLSearchParams.js +2 -3
  66. package/lib/platform/node/index.js +5 -4
  67. package/lib/utils.js +293 -191
  68. package/package.json +55 -22
  69. package/rollup.config.js +36 -6
  70. package/lib/helpers/normalizeHeaderName.js +0 -12
@@ -1,24 +1,53 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('./../utils');
4
- var settle = require('./../core/settle');
5
- var cookies = require('./../helpers/cookies');
6
- var buildURL = require('./../helpers/buildURL');
7
- var buildFullPath = require('../core/buildFullPath');
8
- var parseHeaders = require('./../helpers/parseHeaders');
9
- var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
10
- var transitionalDefaults = require('../defaults/transitional');
11
- var AxiosError = require('../core/AxiosError');
12
- var CanceledError = require('../cancel/CanceledError');
13
- var parseProtocol = require('../helpers/parseProtocol');
14
- var platform = require('../platform');
15
-
16
- module.exports = function xhrAdapter(config) {
3
+ import utils from './../utils.js';
4
+ import settle from './../core/settle.js';
5
+ import cookies from './../helpers/cookies.js';
6
+ import buildURL from './../helpers/buildURL.js';
7
+ import buildFullPath from '../core/buildFullPath.js';
8
+ import isURLSameOrigin from './../helpers/isURLSameOrigin.js';
9
+ import transitionalDefaults from '../defaults/transitional.js';
10
+ import AxiosError from '../core/AxiosError.js';
11
+ import CanceledError from '../cancel/CanceledError.js';
12
+ import parseProtocol from '../helpers/parseProtocol.js';
13
+ import platform from '../platform/index.js';
14
+ import AxiosHeaders from '../core/AxiosHeaders.js';
15
+ import speedometer from '../helpers/speedometer.js';
16
+
17
+ function progressEventReducer(listener, isDownloadStream) {
18
+ let bytesNotified = 0;
19
+ const _speedometer = speedometer(50, 250);
20
+
21
+ return e => {
22
+ const loaded = e.loaded;
23
+ const total = e.lengthComputable ? e.total : undefined;
24
+ const progressBytes = loaded - bytesNotified;
25
+ const rate = _speedometer(progressBytes);
26
+ const inRange = loaded <= total;
27
+
28
+ bytesNotified = loaded;
29
+
30
+ const data = {
31
+ loaded,
32
+ total,
33
+ progress: total ? (loaded / total) : undefined,
34
+ bytes: progressBytes,
35
+ rate: rate ? rate : undefined,
36
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined
37
+ };
38
+
39
+ data[isDownloadStream ? 'download' : 'upload'] = true;
40
+
41
+ listener(data);
42
+ };
43
+ }
44
+
45
+ export default function xhrAdapter(config) {
17
46
  return new Promise(function dispatchXhrRequest(resolve, reject) {
18
- var requestData = config.data;
19
- var requestHeaders = config.headers;
20
- var responseType = config.responseType;
21
- var onCanceled;
47
+ let requestData = config.data;
48
+ const requestHeaders = AxiosHeaders.from(config.headers).normalize();
49
+ const responseType = config.responseType;
50
+ let onCanceled;
22
51
  function done() {
23
52
  if (config.cancelToken) {
24
53
  config.cancelToken.unsubscribe(onCanceled);
@@ -29,20 +58,20 @@ module.exports = function xhrAdapter(config) {
29
58
  }
30
59
  }
31
60
 
32
- if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
33
- delete requestHeaders['Content-Type']; // Let the browser set it
61
+ if (utils.isFormData(requestData) && platform.isStandardBrowserEnv) {
62
+ requestHeaders.setContentType(false); // Let the browser set it
34
63
  }
35
64
 
36
- var request = new XMLHttpRequest();
65
+ let request = new XMLHttpRequest();
37
66
 
38
67
  // HTTP basic authentication
39
68
  if (config.auth) {
40
- var username = config.auth.username || '';
41
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
42
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
69
+ const username = config.auth.username || '';
70
+ const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
71
+ requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
43
72
  }
44
73
 
45
- var fullPath = buildFullPath(config.baseURL, config.url);
74
+ const fullPath = buildFullPath(config.baseURL, config.url);
46
75
 
47
76
  request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
48
77
 
@@ -54,16 +83,18 @@ module.exports = function xhrAdapter(config) {
54
83
  return;
55
84
  }
56
85
  // Prepare the response
57
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
58
- var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
86
+ const responseHeaders = AxiosHeaders.from(
87
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
88
+ );
89
+ const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
59
90
  request.responseText : request.response;
60
- var response = {
91
+ const response = {
61
92
  data: responseData,
62
93
  status: request.status,
63
94
  statusText: request.statusText,
64
95
  headers: responseHeaders,
65
- config: config,
66
- request: request
96
+ config,
97
+ request
67
98
  };
68
99
 
69
100
  settle(function _resolve(value) {
@@ -125,8 +156,8 @@ module.exports = function xhrAdapter(config) {
125
156
 
126
157
  // Handle timeout
127
158
  request.ontimeout = function handleTimeout() {
128
- var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
129
- var transitional = config.transitional || transitionalDefaults;
159
+ let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
160
+ const transitional = config.transitional || transitionalDefaults;
130
161
  if (config.timeoutErrorMessage) {
131
162
  timeoutErrorMessage = config.timeoutErrorMessage;
132
163
  }
@@ -143,27 +174,23 @@ module.exports = function xhrAdapter(config) {
143
174
  // Add xsrf header
144
175
  // This is only done if running in a standard browser environment.
145
176
  // Specifically not if we're in a web worker, or react-native.
146
- if (utils.isStandardBrowserEnv()) {
177
+ if (platform.isStandardBrowserEnv) {
147
178
  // Add xsrf header
148
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
149
- cookies.read(config.xsrfCookieName) :
150
- undefined;
179
+ const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
180
+ && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
151
181
 
152
182
  if (xsrfValue) {
153
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
183
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
154
184
  }
155
185
  }
156
186
 
187
+ // Remove Content-Type if data is undefined
188
+ requestData === undefined && requestHeaders.setContentType(null);
189
+
157
190
  // Add headers to the request
158
191
  if ('setRequestHeader' in request) {
159
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
160
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
161
- // Remove Content-Type if data is undefined
162
- delete requestHeaders[key];
163
- } else {
164
- // Otherwise add header to the request
165
- request.setRequestHeader(key, val);
166
- }
192
+ utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
193
+ request.setRequestHeader(key, val);
167
194
  });
168
195
  }
169
196
 
@@ -179,22 +206,22 @@ module.exports = function xhrAdapter(config) {
179
206
 
180
207
  // Handle progress if needed
181
208
  if (typeof config.onDownloadProgress === 'function') {
182
- request.addEventListener('progress', config.onDownloadProgress);
209
+ request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
183
210
  }
184
211
 
185
212
  // Not all browsers support upload events
186
213
  if (typeof config.onUploadProgress === 'function' && request.upload) {
187
- request.upload.addEventListener('progress', config.onUploadProgress);
214
+ request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
188
215
  }
189
216
 
190
217
  if (config.cancelToken || config.signal) {
191
218
  // Handle cancellation
192
219
  // eslint-disable-next-line func-names
193
- onCanceled = function(cancel) {
220
+ onCanceled = cancel => {
194
221
  if (!request) {
195
222
  return;
196
223
  }
197
- reject(!cancel || cancel.type ? new CanceledError(null, config, req) : cancel);
224
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
198
225
  request.abort();
199
226
  request = null;
200
227
  };
@@ -205,11 +232,7 @@ module.exports = function xhrAdapter(config) {
205
232
  }
206
233
  }
207
234
 
208
- if (!requestData) {
209
- requestData = null;
210
- }
211
-
212
- var protocol = parseProtocol(fullPath);
235
+ const protocol = parseProtocol(fullPath);
213
236
 
214
237
  if (protocol && platform.protocols.indexOf(protocol) === -1) {
215
238
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
@@ -218,6 +241,6 @@ module.exports = function xhrAdapter(config) {
218
241
 
219
242
 
220
243
  // Send the request
221
- request.send(requestData);
244
+ request.send(requestData || null);
222
245
  });
223
- };
246
+ }
package/lib/axios.js CHANGED
@@ -1,26 +1,36 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('./utils');
4
- var bind = require('./helpers/bind');
5
- var Axios = require('./core/Axios');
6
- var mergeConfig = require('./core/mergeConfig');
7
- var defaults = require('./defaults');
8
- var formDataToJSON = require('./helpers/formDataToJSON');
3
+ import utils from './utils.js';
4
+ import bind from './helpers/bind.js';
5
+ import Axios from './core/Axios.js';
6
+ import mergeConfig from './core/mergeConfig.js';
7
+ import defaults from './defaults/index.js';
8
+ import formDataToJSON from './helpers/formDataToJSON.js';
9
+ import CanceledError from './cancel/CanceledError.js';
10
+ import CancelToken from'./cancel/CancelToken.js';
11
+ import isCancel from'./cancel/isCancel.js';
12
+ import {VERSION} from './env/data.js';
13
+ import toFormData from './helpers/toFormData.js';
14
+ import AxiosError from './core/AxiosError.js';
15
+ import spread from './helpers/spread.js';
16
+ import isAxiosError from './helpers/isAxiosError.js';
17
+
9
18
  /**
10
19
  * Create an instance of Axios
11
20
  *
12
21
  * @param {Object} defaultConfig The default config for the instance
13
- * @return {Axios} A new instance of Axios
22
+ *
23
+ * @returns {Axios} A new instance of Axios
14
24
  */
15
25
  function createInstance(defaultConfig) {
16
- var context = new Axios(defaultConfig);
17
- var instance = bind(Axios.prototype.request, context);
26
+ const context = new Axios(defaultConfig);
27
+ const instance = bind(Axios.prototype.request, context);
18
28
 
19
29
  // Copy axios.prototype to instance
20
- utils.extend(instance, Axios.prototype, context);
30
+ utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
21
31
 
22
32
  // Copy context to instance
23
- utils.extend(instance, context);
33
+ utils.extend(instance, context, null, {allOwnKeys: true});
24
34
 
25
35
  // Factory for creating new instances
26
36
  instance.create = function create(instanceConfig) {
@@ -31,20 +41,20 @@ function createInstance(defaultConfig) {
31
41
  }
32
42
 
33
43
  // Create the default instance to be exported
34
- var axios = createInstance(defaults);
44
+ const axios = createInstance(defaults);
35
45
 
36
46
  // Expose Axios class to allow class inheritance
37
47
  axios.Axios = Axios;
38
48
 
39
49
  // Expose Cancel & CancelToken
40
- axios.CanceledError = require('./cancel/CanceledError');
41
- axios.CancelToken = require('./cancel/CancelToken');
42
- axios.isCancel = require('./cancel/isCancel');
43
- axios.VERSION = require('./env/data').version;
44
- axios.toFormData = require('./helpers/toFormData');
50
+ axios.CanceledError = CanceledError;
51
+ axios.CancelToken = CancelToken;
52
+ axios.isCancel = isCancel;
53
+ axios.VERSION = VERSION;
54
+ axios.toFormData = toFormData;
45
55
 
46
56
  // Expose AxiosError class
47
- axios.AxiosError = require('../lib/core/AxiosError');
57
+ axios.AxiosError = AxiosError;
48
58
 
49
59
  // alias for CanceledError for backward compatibility
50
60
  axios.Cancel = axios.CanceledError;
@@ -53,16 +63,14 @@ axios.Cancel = axios.CanceledError;
53
63
  axios.all = function all(promises) {
54
64
  return Promise.all(promises);
55
65
  };
56
- axios.spread = require('./helpers/spread');
66
+
67
+ axios.spread = spread;
57
68
 
58
69
  // Expose isAxiosError
59
- axios.isAxiosError = require('./helpers/isAxiosError');
70
+ axios.isAxiosError = isAxiosError;
60
71
 
61
- axios.formToJSON = function(thing) {
72
+ axios.formToJSON = thing => {
62
73
  return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
63
74
  };
64
75
 
65
- module.exports = axios;
66
-
67
- // Allow use of default import syntax in TypeScript
68
- module.exports.default = axios;
76
+ export default axios;
@@ -1,118 +1,121 @@
1
1
  'use strict';
2
2
 
3
- var CanceledError = require('./CanceledError');
3
+ import CanceledError from './CanceledError.js';
4
4
 
5
5
  /**
6
6
  * A `CancelToken` is an object that can be used to request cancellation of an operation.
7
7
  *
8
- * @class
9
8
  * @param {Function} executor The executor function.
9
+ *
10
+ * @returns {CancelToken}
10
11
  */
11
- function CancelToken(executor) {
12
- if (typeof executor !== 'function') {
13
- throw new TypeError('executor must be a function.');
14
- }
12
+ class CancelToken {
13
+ constructor(executor) {
14
+ if (typeof executor !== 'function') {
15
+ throw new TypeError('executor must be a function.');
16
+ }
15
17
 
16
- var resolvePromise;
18
+ let resolvePromise;
17
19
 
18
- this.promise = new Promise(function promiseExecutor(resolve) {
19
- resolvePromise = resolve;
20
- });
20
+ this.promise = new Promise(function promiseExecutor(resolve) {
21
+ resolvePromise = resolve;
22
+ });
21
23
 
22
- var token = this;
24
+ const token = this;
23
25
 
24
- // eslint-disable-next-line func-names
25
- this.promise.then(function(cancel) {
26
- if (!token._listeners) return;
26
+ // eslint-disable-next-line func-names
27
+ this.promise.then(cancel => {
28
+ if (!token._listeners) return;
27
29
 
28
- var i = token._listeners.length;
30
+ let i = token._listeners.length;
29
31
 
30
- while (i-- > 0) {
31
- token._listeners[i](cancel);
32
- }
33
- token._listeners = null;
34
- });
32
+ while (i-- > 0) {
33
+ token._listeners[i](cancel);
34
+ }
35
+ token._listeners = null;
36
+ });
35
37
 
36
- // eslint-disable-next-line func-names
37
- this.promise.then = function(onfulfilled) {
38
- var _resolve;
39
38
  // eslint-disable-next-line func-names
40
- var promise = new Promise(function(resolve) {
41
- token.subscribe(resolve);
42
- _resolve = resolve;
43
- }).then(onfulfilled);
44
-
45
- promise.cancel = function reject() {
46
- token.unsubscribe(_resolve);
39
+ this.promise.then = onfulfilled => {
40
+ let _resolve;
41
+ // eslint-disable-next-line func-names
42
+ const promise = new Promise(resolve => {
43
+ token.subscribe(resolve);
44
+ _resolve = resolve;
45
+ }).then(onfulfilled);
46
+
47
+ promise.cancel = function reject() {
48
+ token.unsubscribe(_resolve);
49
+ };
50
+
51
+ return promise;
47
52
  };
48
53
 
49
- return promise;
50
- };
54
+ executor(function cancel(message, config, request) {
55
+ if (token.reason) {
56
+ // Cancellation has already been requested
57
+ return;
58
+ }
51
59
 
52
- executor(function cancel(message, config, request) {
53
- if (token.reason) {
54
- // Cancellation has already been requested
55
- return;
56
- }
57
-
58
- token.reason = new CanceledError(message, config, request);
59
- resolvePromise(token.reason);
60
- });
61
- }
60
+ token.reason = new CanceledError(message, config, request);
61
+ resolvePromise(token.reason);
62
+ });
63
+ }
62
64
 
63
- /**
64
- * Throws a `CanceledError` if cancellation has been requested.
65
- */
66
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
67
- if (this.reason) {
68
- throw this.reason;
65
+ /**
66
+ * Throws a `CanceledError` if cancellation has been requested.
67
+ */
68
+ throwIfRequested() {
69
+ if (this.reason) {
70
+ throw this.reason;
71
+ }
69
72
  }
70
- };
71
73
 
72
- /**
73
- * Subscribe to the cancel signal
74
- */
74
+ /**
75
+ * Subscribe to the cancel signal
76
+ */
75
77
 
76
- CancelToken.prototype.subscribe = function subscribe(listener) {
77
- if (this.reason) {
78
- listener(this.reason);
79
- return;
80
- }
78
+ subscribe(listener) {
79
+ if (this.reason) {
80
+ listener(this.reason);
81
+ return;
82
+ }
81
83
 
82
- if (this._listeners) {
83
- this._listeners.push(listener);
84
- } else {
85
- this._listeners = [listener];
84
+ if (this._listeners) {
85
+ this._listeners.push(listener);
86
+ } else {
87
+ this._listeners = [listener];
88
+ }
86
89
  }
87
- };
88
90
 
89
- /**
90
- * Unsubscribe from the cancel signal
91
- */
91
+ /**
92
+ * Unsubscribe from the cancel signal
93
+ */
92
94
 
93
- CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
94
- if (!this._listeners) {
95
- return;
95
+ unsubscribe(listener) {
96
+ if (!this._listeners) {
97
+ return;
98
+ }
99
+ const index = this._listeners.indexOf(listener);
100
+ if (index !== -1) {
101
+ this._listeners.splice(index, 1);
102
+ }
96
103
  }
97
- var index = this._listeners.indexOf(listener);
98
- if (index !== -1) {
99
- this._listeners.splice(index, 1);
104
+
105
+ /**
106
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
107
+ * cancels the `CancelToken`.
108
+ */
109
+ static source() {
110
+ let cancel;
111
+ const token = new CancelToken(function executor(c) {
112
+ cancel = c;
113
+ });
114
+ return {
115
+ token,
116
+ cancel
117
+ };
100
118
  }
101
- };
119
+ }
102
120
 
103
- /**
104
- * Returns an object that contains a new `CancelToken` and a function that, when called,
105
- * cancels the `CancelToken`.
106
- */
107
- CancelToken.source = function source() {
108
- var cancel;
109
- var token = new CancelToken(function executor(c) {
110
- cancel = c;
111
- });
112
- return {
113
- token: token,
114
- cancel: cancel
115
- };
116
- };
117
-
118
- module.exports = CancelToken;
121
+ export default CancelToken;
@@ -1,15 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var AxiosError = require('../core/AxiosError');
4
- var utils = require('../utils');
3
+ import AxiosError from '../core/AxiosError.js';
4
+ import utils from '../utils.js';
5
5
 
6
6
  /**
7
7
  * A `CanceledError` is an object that is thrown when an operation is canceled.
8
8
  *
9
- * @class
10
9
  * @param {string=} message The message.
11
10
  * @param {Object=} config The config.
12
11
  * @param {Object=} request The request.
12
+ *
13
+ * @returns {CanceledError} The created error.
13
14
  */
14
15
  function CanceledError(message, config, request) {
15
16
  // eslint-disable-next-line no-eq-null,eqeqeq
@@ -21,4 +22,4 @@ utils.inherits(CanceledError, AxiosError, {
21
22
  __CANCEL__: true
22
23
  });
23
24
 
24
- module.exports = CanceledError;
25
+ export default CanceledError;
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- module.exports = function isCancel(value) {
3
+ export default function isCancel(value) {
4
4
  return !!(value && value.__CANCEL__);
5
- };
5
+ }