Created
April 1, 2016 23:41
-
-
Save Bear-Foot/fe40b7644de21ca25cbec8a48dcf2252 to your computer and use it in GitHub Desktop.
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
function arg1(arg){return arg === 1} | |
function arg2(arg){return arg !== 1} | |
function combineFilters(filters) { | |
return filters.reduce(function (prev, curr) { | |
return function (arg) { | |
return prev(arg) && curr(arg) | |
} | |
}, function (){return true}) | |
} | |
console.log(combineFilters([arg2, arg1, arg1])(1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment