mirror of
https://github.com/tenrok/axios.git
synced 2026-06-05 16:42:32 +03:00
Using more strict eslint rules
This commit is contained in:
@@ -14,7 +14,7 @@ function InterceptorManager() {
|
||||
*
|
||||
* @return {Number} An ID used to remove interceptor later
|
||||
*/
|
||||
InterceptorManager.prototype.use = function (fulfilled, rejected) {
|
||||
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
||||
this.handlers.push({
|
||||
fulfilled: fulfilled,
|
||||
rejected: rejected
|
||||
@@ -27,7 +27,7 @@ InterceptorManager.prototype.use = function (fulfilled, rejected) {
|
||||
*
|
||||
* @param {Number} id The ID that was returned by `use`
|
||||
*/
|
||||
InterceptorManager.prototype.eject = function (id) {
|
||||
InterceptorManager.prototype.eject = function eject(id) {
|
||||
if (this.handlers[id]) {
|
||||
this.handlers[id] = null;
|
||||
}
|
||||
@@ -37,12 +37,12 @@ InterceptorManager.prototype.eject = function (id) {
|
||||
* Iterate over all the registered interceptors
|
||||
*
|
||||
* This method is particularly useful for skipping over any
|
||||
* interceptors that may have become `null` calling `remove`.
|
||||
* interceptors that may have become `null` calling `eject`.
|
||||
*
|
||||
* @param {Function} fn The function to call for each interceptor
|
||||
*/
|
||||
InterceptorManager.prototype.forEach = function (fn) {
|
||||
utils.forEach(this.handlers, function (h) {
|
||||
InterceptorManager.prototype.forEach = function forEach(fn) {
|
||||
utils.forEach(this.handlers, function forEachHandler(h) {
|
||||
if (h !== null) {
|
||||
fn(h);
|
||||
}
|
||||
|
||||
@@ -8,14 +8,13 @@
|
||||
* @returns {Promise} The Promise to be fulfilled
|
||||
*/
|
||||
module.exports = function dispatchRequest(config) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise(function executor(resolve, reject) {
|
||||
try {
|
||||
// For browsers use XHR adapter
|
||||
if ((typeof XMLHttpRequest !== 'undefined') || (typeof ActiveXObject !== 'undefined')) {
|
||||
// For browsers use XHR adapter
|
||||
require('../adapters/xhr')(resolve, reject, config);
|
||||
}
|
||||
// For node use HTTP adapter
|
||||
else if (typeof process !== 'undefined') {
|
||||
} else if (typeof process !== 'undefined') {
|
||||
// For node use HTTP adapter
|
||||
require('../adapters/http')(resolve, reject, config);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user