开发者

How to name this function [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 9 years ago.

Improve this question

Given 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(); ...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜