Dedent by using early returns.

This commit is contained in:
voussoir 2020-06-28 17:07:28 -07:00
parent b817a7e8b9
commit 68f52271f1

View file

@ -12,10 +12,16 @@ function _request(method, url, callback)
request.onreadystatechange = function() request.onreadystatechange = function()
{ {
if (request.readyState == 4) if (request.readyState != 4)
{ {
if (callback != null) return;
}
if (callback == null)
{ {
return;
}
if (request.status != 0) if (request.status != 0)
{ {
response.completed = true; response.completed = true;
@ -26,8 +32,6 @@ function _request(method, url, callback)
"status": request.status "status": request.status
} }
callback(response); callback(response);
}
}
}; };
var asynchronous = true; var asynchronous = true;
request.open(method, url, asynchronous); request.open(method, url, asynchronous);