Created
January 18, 2018 17:57
-
-
Save igorpavlov-zz/405ad149025fef78b1718e71de5f8ea6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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