Last active
August 29, 2015 14:05
-
-
Save webbower/0b9b72ee387c2127cfbe to your computer and use it in GitHub Desktop.
Misc functional utilities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requires tester.js for isFunction() | |
function not(val) { | |
return !(value); | |
} | |
function unbind(fn) { | |
return function() { | |
return fn.apply(arguments[0], Array.prototype.slice.call(arguments, 1)); | |
}; | |
} | |
function result(val) { | |
return isFunction(val) ? val() : val; | |
} | |
function ite(iff, thn, els) { | |
return result(result(iff) ? thn : els); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment