UNPKG

moy-fp

Version:
19 lines (16 loc) 384 B
import curry from '../Function/curry' import nAry from '../Function/nAry' /** * [(a, b, ... m) -> Boolean] -> ((a, b, ..., m) -> Boolean) */ const allPass = curry( preds => nAry(preds.reduce((n, p) => Math.max(n, p.length), 0), (...args) => { for(let pred of preds){ if(!pred(...args)){ return false } } return true }) ) export default allPass