开发者

How to name this function [closed]

开发者 https://www.devze.com 2023-03-21 23:24 出处:网络
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. 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

精彩评论

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

关注公众号