2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

Adding ESLint

This commit is contained in:
mzabriskie
2015-03-17 14:14:26 -06:00
parent 7387829d33
commit a98c61f458
17 changed files with 128 additions and 77 deletions
+31 -23
View File
@@ -6,6 +6,8 @@ var InterceptorManager = require('./core/InterceptorManager');
// Polyfill ES6 Promise if needed
(function () {
'use strict';
// webpack is being used to set es6-promise to the native Promise
// for the standalone build. It's necessary to make sure polyfill exists.
var P = require('es6-promise');
@@ -15,6 +17,8 @@ var InterceptorManager = require('./core/InterceptorManager');
})();
var axios = module.exports = function axios(config) {
'use strict';
config = utils.merge({
method: 'get',
headers: {},
@@ -69,6 +73,7 @@ axios.defaults = defaults;
// Expose all/spread
axios.all = function (promises) {
'use strict';
return Promise.all(promises);
};
axios.spread = require('./helpers/spread');
@@ -80,29 +85,32 @@ axios.interceptors = {
};
// Provide aliases for supported request methods
createShortMethods('delete', 'get', 'head');
createShortMethodsWithData('post', 'put', 'patch');
(function () {
'use strict';
function createShortMethods() {
utils.forEach(arguments, function (method) {
axios[method] = function (url, config) {
return axios(utils.merge(config || {}, {
method: method,
url: url
}));
};
});
}
function createShortMethods() {
utils.forEach(arguments, function (method) {
axios[method] = function (url, config) {
return axios(utils.merge(config || {}, {
method: method,
url: url
}));
};
});
}
function createShortMethodsWithData() {
utils.forEach(arguments, function (method) {
axios[method] = function (url, data, config) {
return axios(utils.merge(config || {}, {
method: method,
url: url,
data: data
}));
};
});
}
function createShortMethodsWithData() {
utils.forEach(arguments, function (method) {
axios[method] = function (url, data, config) {
return axios(utils.merge(config || {}, {
method: method,
url: url,
data: data
}));
};
});
}
createShortMethods('delete', 'get', 'head');
createShortMethodsWithData('post', 'put', 'patch');
})();