axios 0.31.1 → 0.32.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.
package/lib/utils.js CHANGED
@@ -49,8 +49,14 @@ function isUndefined(val) {
49
49
  * @returns {boolean} True if value is a Buffer, otherwise false
50
50
  */
51
51
  function isBuffer(val) {
52
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
53
- && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
52
+ return (
53
+ val !== null &&
54
+ !isUndefined(val) &&
55
+ val.constructor !== null &&
56
+ !isUndefined(val.constructor) &&
57
+ typeof val.constructor.isBuffer === 'function' &&
58
+ val.constructor.isBuffer(val)
59
+ );
54
60
  }
55
61
 
56
62
  /**
@@ -62,7 +68,6 @@ function isBuffer(val) {
62
68
  */
63
69
  var isArrayBuffer = kindOfTest('ArrayBuffer');
64
70
 
65
-
66
71
  /**
67
72
  * Determine if a value is a view on an ArrayBuffer
68
73
  *
@@ -71,10 +76,10 @@ var isArrayBuffer = kindOfTest('ArrayBuffer');
71
76
  */
72
77
  function isArrayBufferView(val) {
73
78
  var result;
74
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
79
+ if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
75
80
  result = ArrayBuffer.isView(val);
76
81
  } else {
77
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
82
+ result = val && val.buffer && isArrayBuffer(val.buffer);
78
83
  }
79
84
  return result;
80
85
  }
@@ -211,12 +216,14 @@ function isFormData(thing) {
211
216
  // Reject non-objects (strings, numbers, booleans) up front — Object.getPrototypeOf
212
217
  // throws a TypeError on primitives in ES5 environments.
213
218
  if (!isObject(thing)) return false;
214
- // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData (GHSA-6chq-wfr3-2hj9).
219
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
215
220
  var proto = Object.getPrototypeOf(thing);
216
221
  if (!proto || proto === Object.prototype) return false;
217
222
  if (!isFunction(thing.append)) return false;
218
- return toString.call(thing) === pattern ||
219
- (isFunction(thing.toString) && thing.toString() === pattern);
223
+ return (
224
+ toString.call(thing) === pattern ||
225
+ (isFunction(thing.toString) && thing.toString() === pattern)
226
+ );
220
227
  }
221
228
 
222
229
  /**
@@ -234,7 +241,9 @@ var isURLSearchParams = kindOfTest('URLSearchParams');
234
241
  * @returns {String} The String freed of excess whitespace
235
242
  */
236
243
  function trim(str) {
237
- return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
244
+ return str.trim
245
+ ? str.trim()
246
+ : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
238
247
  }
239
248
 
240
249
  /**
@@ -254,10 +263,11 @@ function trim(str) {
254
263
  */
255
264
  function isStandardBrowserEnv() {
256
265
  var product;
257
- if (typeof navigator !== 'undefined' && (
258
- (product = navigator.product) === 'ReactNative' ||
259
- product === 'NativeScript' ||
260
- product === 'NS')
266
+ if (
267
+ typeof navigator !== 'undefined' &&
268
+ ((product = navigator.product) === 'ReactNative' ||
269
+ product === 'NativeScript' ||
270
+ product === 'NS')
261
271
  ) {
262
272
  return false;
263
273
  }
@@ -322,14 +332,20 @@ function forEach(obj, fn) {
322
332
  * @returns {Object} Result of all merge properties
323
333
  */
324
334
  function merge(/* obj1, obj2, obj3, ... */) {
325
- var result = {};
335
+ var result = Object.create(null);
326
336
  function assignValue(val, key) {
337
+ var target;
338
+
327
339
  if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
328
340
  return;
329
341
  }
330
342
 
331
- if (isPlainObject(result[key]) && isPlainObject(val)) {
332
- result[key] = merge(result[key], val);
343
+ target = Object.prototype.hasOwnProperty.call(result, key)
344
+ ? result[key]
345
+ : undefined;
346
+
347
+ if (isPlainObject(target) && isPlainObject(val)) {
348
+ result[key] = merge(target, val);
333
349
  } else if (isPlainObject(val)) {
334
350
  result[key] = merge({}, val);
335
351
  } else if (isArray(val)) {
@@ -371,7 +387,7 @@ function extend(a, b, thisArg) {
371
387
  * @return {string} content value without BOM
372
388
  */
373
389
  function stripBOM(content) {
374
- if (content.charCodeAt(0) === 0xFEFF) {
390
+ if (content.charCodeAt(0) === 0xfeff) {
375
391
  content = content.slice(1);
376
392
  }
377
393
  return content;
@@ -386,7 +402,10 @@ function stripBOM(content) {
386
402
  */
387
403
 
388
404
  function inherits(constructor, superConstructor, props, descriptors) {
389
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
405
+ constructor.prototype = Object.create(
406
+ superConstructor.prototype,
407
+ descriptors
408
+ );
390
409
  constructor.prototype.constructor = constructor;
391
410
  props && Object.assign(constructor.prototype, props);
392
411
  }
@@ -415,13 +434,20 @@ function toFlatObject(sourceObj, destObj, filter, propFilter) {
415
434
  i = props.length;
416
435
  while (i-- > 0) {
417
436
  prop = props[i];
418
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
437
+ if (
438
+ (!propFilter || propFilter(prop, sourceObj, destObj)) &&
439
+ !merged[prop]
440
+ ) {
419
441
  destObj[prop] = sourceObj[prop];
420
442
  merged[prop] = true;
421
443
  }
422
444
  }
423
445
  sourceObj = filter !== false && Object.getPrototypeOf(sourceObj);
424
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
446
+ } while (
447
+ sourceObj &&
448
+ (!filter || filter(sourceObj, destObj)) &&
449
+ sourceObj !== Object.prototype
450
+ );
425
451
 
426
452
  return destObj;
427
453
  }
@@ -443,7 +469,6 @@ function endsWith(str, searchString, position) {
443
469
  return lastIndex !== -1 && lastIndex === position;
444
470
  }
445
471
 
446
-
447
472
  /**
448
473
  * Returns new array from array like object or null if failed
449
474
  * @param {*} [thing]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "0.31.1",
3
+ "version": "0.32.0",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",