mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
Adding ESLint
This commit is contained in:
+17
-2
@@ -1,3 +1,4 @@
|
||||
/*global toString:true*/
|
||||
// utils is a library of generic helper functions non-specific to axios
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
@@ -9,6 +10,7 @@ var toString = Object.prototype.toString;
|
||||
* @returns {boolean} True if value is an Array, otherwise false
|
||||
*/
|
||||
function isArray(val) {
|
||||
'use strict';
|
||||
return toString.call(val) === '[object Array]';
|
||||
}
|
||||
|
||||
@@ -19,6 +21,7 @@ function isArray(val) {
|
||||
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
||||
*/
|
||||
function isArrayBuffer(val) {
|
||||
'use strict';
|
||||
return toString.call(val) === '[object ArrayBuffer]';
|
||||
}
|
||||
|
||||
@@ -29,6 +32,7 @@ function isArrayBuffer(val) {
|
||||
* @returns {boolean} True if value is an FormData, otherwise false
|
||||
*/
|
||||
function isFormData(val) {
|
||||
'use strict';
|
||||
return toString.call(val) === '[object FormData]';
|
||||
}
|
||||
|
||||
@@ -39,6 +43,7 @@ function isFormData(val) {
|
||||
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
||||
*/
|
||||
function isArrayBufferView(val) {
|
||||
'use strict';
|
||||
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
||||
return ArrayBuffer.isView(val);
|
||||
} else {
|
||||
@@ -53,6 +58,7 @@ function isArrayBufferView(val) {
|
||||
* @returns {boolean} True if value is a String, otherwise false
|
||||
*/
|
||||
function isString(val) {
|
||||
'use strict';
|
||||
return typeof val === 'string';
|
||||
}
|
||||
|
||||
@@ -63,6 +69,7 @@ function isString(val) {
|
||||
* @returns {boolean} True if value is a Number, otherwise false
|
||||
*/
|
||||
function isNumber(val) {
|
||||
'use strict';
|
||||
return typeof val === 'number';
|
||||
}
|
||||
|
||||
@@ -73,6 +80,7 @@ function isNumber(val) {
|
||||
* @returns {boolean} True if the value is undefined, otherwise false
|
||||
*/
|
||||
function isUndefined(val) {
|
||||
'use strict';
|
||||
return typeof val === 'undefined';
|
||||
}
|
||||
|
||||
@@ -83,6 +91,7 @@ function isUndefined(val) {
|
||||
* @returns {boolean} True if value is an Object, otherwise false
|
||||
*/
|
||||
function isObject(val) {
|
||||
'use strict';
|
||||
return val !== null && typeof val === 'object';
|
||||
}
|
||||
|
||||
@@ -93,6 +102,7 @@ function isObject(val) {
|
||||
* @returns {boolean} True if value is a Date, otherwise false
|
||||
*/
|
||||
function isDate(val) {
|
||||
'use strict';
|
||||
return toString.call(val) === '[object Date]';
|
||||
}
|
||||
|
||||
@@ -103,6 +113,7 @@ function isDate(val) {
|
||||
* @returns {boolean} True if value is a File, otherwise false
|
||||
*/
|
||||
function isFile(val) {
|
||||
'use strict';
|
||||
return toString.call(val) === '[object File]';
|
||||
}
|
||||
|
||||
@@ -113,6 +124,7 @@ function isFile(val) {
|
||||
* @returns {boolean} True if value is a Blob, otherwise false
|
||||
*/
|
||||
function isBlob(val) {
|
||||
'use strict';
|
||||
return toString.call(val) === '[object Blob]';
|
||||
}
|
||||
|
||||
@@ -123,6 +135,7 @@ function isBlob(val) {
|
||||
* @returns {String} The String freed of excess whitespace
|
||||
*/
|
||||
function trim(str) {
|
||||
'use strict';
|
||||
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
||||
}
|
||||
|
||||
@@ -139,6 +152,7 @@ function trim(str) {
|
||||
* @param {Function} fn The callback to invoke for each item
|
||||
*/
|
||||
function forEach(obj, fn) {
|
||||
'use strict';
|
||||
// Don't bother if no value provided
|
||||
if (obj === null || typeof obj === 'undefined') {
|
||||
return;
|
||||
@@ -154,7 +168,7 @@ function forEach(obj, fn) {
|
||||
|
||||
// Iterate over array values
|
||||
if (isArrayLike) {
|
||||
for (var i=0, l=obj.length; i<l; i++) {
|
||||
for (var i = 0, l = obj.length; i < l; i++) {
|
||||
fn.call(null, obj[i], i, obj);
|
||||
}
|
||||
}
|
||||
@@ -185,7 +199,8 @@ function forEach(obj, fn) {
|
||||
* @param {Object} obj1 Object to merge
|
||||
* @returns {Object} Result of all merge properties
|
||||
*/
|
||||
function merge(obj1/*, obj2, obj3, ...*/) {
|
||||
function merge(/*obj1, obj2, obj3, ...*/) {
|
||||
'use strict';
|
||||
var result = {};
|
||||
forEach(arguments, function (obj) {
|
||||
forEach(obj, function (val, key) {
|
||||
|
||||
Reference in New Issue
Block a user