mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
refactor(rest) early return
This commit is contained in:
parent
b269ce95b4
commit
62461ad338
1 changed files with 6 additions and 8 deletions
|
|
@ -87,23 +87,21 @@ function sendData(params, callback) {
|
|||
const isMD = RegExp('^/markdown').test(p.name);
|
||||
|
||||
if (isMD)
|
||||
return markdown(p.name, p.request, (error, data) => {
|
||||
callback(error, data);
|
||||
});
|
||||
return markdown(p.name, p.request, callback);
|
||||
|
||||
switch(p.request.method) {
|
||||
const method = p.request.method;
|
||||
|
||||
switch(method) {
|
||||
case 'GET':
|
||||
onGET(params, callback);
|
||||
break;
|
||||
return onGET(params, callback);
|
||||
|
||||
case 'PUT':
|
||||
pullout(p.request, 'string', (error, body) => {
|
||||
return pullout(p.request, 'string', (error, body) => {
|
||||
if (error)
|
||||
return callback(error);
|
||||
|
||||
onPUT(p.name, body, callback);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue