mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
Revert "Update Webpack + deps, remove now unnecessary polyfills" (#2479)
* Revert "Update Webpack + deps, remove now unnecessary polyfills (#2410)"
This reverts commit 189b34c45a.
* Fix build (#2496)
* Change syntax to see if build passes
* Test commit
* Test with node 10
* Test adding all browsers in travis
* remove other browsers when running on travis
This commit is contained in:
+32
-8
@@ -3,9 +3,21 @@
|
||||
var bind = require('./helpers/bind');
|
||||
var isBuffer = require('is-buffer');
|
||||
|
||||
/*global toString:true*/
|
||||
|
||||
// utils is a library of generic helper functions non-specific to axios
|
||||
|
||||
var _toString = Object.prototype.toString;
|
||||
var toString = Object.prototype.toString;
|
||||
|
||||
/**
|
||||
* Determine if a value is an Array
|
||||
*
|
||||
* @param {Object} val The value to test
|
||||
* @returns {boolean} True if value is an Array, otherwise false
|
||||
*/
|
||||
function isArray(val) {
|
||||
return toString.call(val) === '[object Array]';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a value is an ArrayBuffer
|
||||
@@ -14,7 +26,7 @@ var _toString = Object.prototype.toString;
|
||||
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
||||
*/
|
||||
function isArrayBuffer(val) {
|
||||
return _toString.call(val) === '[object ArrayBuffer]';
|
||||
return toString.call(val) === '[object ArrayBuffer]';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +102,7 @@ function isObject(val) {
|
||||
* @returns {boolean} True if value is a Date, otherwise false
|
||||
*/
|
||||
function isDate(val) {
|
||||
return _toString.call(val) === '[object Date]';
|
||||
return toString.call(val) === '[object Date]';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +112,7 @@ function isDate(val) {
|
||||
* @returns {boolean} True if value is a File, otherwise false
|
||||
*/
|
||||
function isFile(val) {
|
||||
return _toString.call(val) === '[object File]';
|
||||
return toString.call(val) === '[object File]';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,7 +122,7 @@ function isFile(val) {
|
||||
* @returns {boolean} True if value is a Blob, otherwise false
|
||||
*/
|
||||
function isBlob(val) {
|
||||
return _toString.call(val) === '[object Blob]';
|
||||
return toString.call(val) === '[object Blob]';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,7 +132,7 @@ function isBlob(val) {
|
||||
* @returns {boolean} True if value is a Function, otherwise false
|
||||
*/
|
||||
function isFunction(val) {
|
||||
return _toString.call(val) === '[object Function]';
|
||||
return toString.call(val) === '[object Function]';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,6 +155,16 @@ function isURLSearchParams(val) {
|
||||
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim excess whitespace off the beginning and end of a string
|
||||
*
|
||||
* @param {String} str The String to trim
|
||||
* @returns {String} The String freed of excess whitespace
|
||||
*/
|
||||
function trim(str) {
|
||||
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if we're running in a standard browser environment
|
||||
*
|
||||
@@ -194,7 +216,7 @@ function forEach(obj, fn) {
|
||||
obj = [obj];
|
||||
}
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
if (isArray(obj)) {
|
||||
// Iterate over array values
|
||||
for (var i = 0, l = obj.length; i < l; i++) {
|
||||
fn.call(null, obj[i], i, obj);
|
||||
@@ -288,6 +310,7 @@ function extend(a, b, thisArg) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isArray: isArray,
|
||||
isArrayBuffer: isArrayBuffer,
|
||||
isBuffer: isBuffer,
|
||||
isFormData: isFormData,
|
||||
@@ -306,5 +329,6 @@ module.exports = {
|
||||
forEach: forEach,
|
||||
merge: merge,
|
||||
deepMerge: deepMerge,
|
||||
extend: extend
|
||||
extend: extend,
|
||||
trim: trim
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user