Skip to content

Instantly share code, notes, and snippets.

@medikoo
Created October 13, 2014 07:12
Show Gist options
  • Save medikoo/27e2100204c90caf2eda to your computer and use it in GitHub Desktop.
Save medikoo/27e2100204c90caf2eda to your computer and use it in GitHub Desktop.
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