Created
October 13, 2014 07:12
-
-
Save medikoo/27e2100204c90caf2eda to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var not = function (fn) { | |
return function () { | |
return !fn.apply(this, arguments); | |
}; | |
}; | |
var getIncremenentIfTrue = function (fn) { | |
return function (count, predicate) { | |
if (fn(predicate)) ++count; | |
return count; | |
}; | |
}; | |
arr.reduce(getIncrementIfTrue(not(Boolean)), 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment