Skip to content

Instantly share code, notes, and snippets.

@Mizzlr
Created June 16, 2016 08:51
Show Gist options
  • Save Mizzlr/f965c0d0fd6726d22e9d99a5ecddb394 to your computer and use it in GitHub Desktop.
Save Mizzlr/f965c0d0fd6726d22e9d99a5ecddb394 to your computer and use it in GitHub Desktop.
var IF = function (test) {
return function (onTrue) {
return function (onFalse) {
return test(onTrue)(onFalse);
};
};
};
// example use
IF(TRUE)(trueBlock)(falseBlock);
// Note: IF, TRUE, trueBlock, falseBlock are all functions
// the above function call will execute trueBlock function
IF(FALSE)(trueBlock)(falseBlock);
// will execute falseBlock function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment