IfThen.ifThenFinally()

If the provided value is true, then run the "then" circuit. Otherwise run the "else" circuit. Either way, exit "success".

Usage

Hover over inputs/exits for more info.

var IfThen = require('machinepack-ifthen');


// If the provided value is true, then run the "then" circuit. Otherwise run the "else" circuit. Either way, exit "success".

IfThen.ifThenFinally({

then: '->',

bool: true,

orElse: '->',

expectedOutput: '*',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function () {

 

},

});

Inputs

then required

'->'
bool

The true/false value to check.

true
orElse

'->'
expectedOutput

An example of the expected output value.

'*'

Exits

error

An unexpected error occurred.

success

OK.

(varies based on provided inputs)