Skip to content

Instantly share code, notes, and snippets.

@igorpavlov-zz
Created January 18, 2018 17:57
Show Gist options
  • Save igorpavlov-zz/405ad149025fef78b1718e71de5f8ea6 to your computer and use it in GitHub Desktop.
Save igorpavlov-zz/405ad149025fef78b1718e71de5f8ea6 to your computer and use it in GitHub Desktop.
// Original
Task1(param, {
config: config
})
.then(function (result) {
return Task2(result);
});
.then(Task3);
.then(function (result) {
return Task4(result);
});
// Semistandard 12 autofix (DO NOT LEAVE THE CODE LIKE THAT PLEASE)
Task1(param, {
config: config
})
.then(function (result) {
return Task2(result);
});
.then(Task3)
.then(function (result) {
return Task4(result);
});
// ======================
// SO YOU HAVE 2 OPTIONS:
// OPTION 1 - NOT PREFERRED, DO THIS IN CASE OF LARGE FIRST BLOCK
Task1(param, {
config: config
}).then(function (result) {
return Task2(result);
}).then(
Task3
).then(function (result) {
return Task4(result);
});
// OPTION 2 - PREFERRED, BUT ONLY IF THE FIRST BLOCK CAN BE CONVERTED INTO A SHORT (ENOUGH) LINE
Task1(param, { config: config })
.then(function (result) {
return Task2(result);
});
.then(Task3)
.then(function (result) {
return Task4(result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment