How to name this function [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this questionGiven this function:
function foo() {
if (!doStep1) {
return false;
}
if(!doStep2()) {
return false;
}
...
// at this point, the rest can fail,
// but the overall outcome should be considered a success
doStep15();
doStep16();
...开发者_运维技巧
return true;
}
I'd like to wrap everything between the two ... inside another function.
Any idea what to name this function that performs mandatory steps but whose outcome I don't care about?
function mandatorySteps() {
return doStep1() && doStep2() && ...;
}
function optionalSteps() {
doStep15(); doStep16(); ...
}
精彩评论