Skip to content

.butIfIdont? for .iDontAlways.butWhenIdo #38

@brandonscript

Description

@brandonscript
Bro(app)
    .iDontAlways('config.environment.buildURL')
    .butWhenIdo(function(buildURL){
        myURL = buildURL('dev');
    });

This is awesome, but sometimes it's great to not have to check the property again to handle an 'else' exception. Something like:

Bro(app)
    .iDontAlways('config.environment.buildURL')
    .butWhenIdo(function(buildURL){
        myURL = buildURL('dev');
    })
    .butIfIdont(function() {
        // do other stuff
    });

Tried to wire in something like this, but it blew up when trying to add in the fallback function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions