index.js
/**
 * An expression for invoking action when the given value is true.
 * NOTE: When using directly with boolean, given becomes the boolean passed
 * so pass your action in the given parameter.
 * @param {any} given - the condition
 * @param {function} action - the action to perform when condition is true
 * @param {function} actionWhatIfNot - the action to perform when condition is not true
 */
An expression for invoking action when the given value is true.
NOTE: When using directly with boolean, given becomes the boolean passed
so pass your action in the given parameter.
@param {any} given - the condition
@param {function} action - the action to perform when condition is true
@param {function} actionWhatIfNot - the action to perform when condition is not true
An expression for invoking action when the given value is true . NOTE : When using directly with boolean given becomes the boolean passed so pass your action in the given parameter . @param { any } given - the condition @param { function } action - the action to perform when condition is true @param { function } actionWhatIfNot - the action to perform when condition is not true
function whatIf(given, action, actionWhatIfNot = null) {
  given =
    (typeof given === "function" && given) ||
    (given != null && given != undefined && given == true); 
  return whatIfNot.call(this, given, action, actionWhatIfNot);
}
function whatIf ( given , action , actionWhatIfNot = null ) { given = ( typeof given === "function" && given ) || ( given != null && given != undefined && given == true ) ; return whatIfNot . call ( this , given , action , actionWhatIfNot ) ; }
An expression for invoking action when the given value is true.
An expression for invoking action when the given value is true .
//non-strict mode is intentional