Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 406 Bytes

and.md

File metadata and controls

18 lines (13 loc) · 406 Bytes

and

Build a function that will result the and evaluation of the provided predicates. The arity of this function is dynamic, so you can pass any number of predicates to the function.

and(divisibleBy2, divisibleBy7)(14) // ⇒  true
and(divisibleBy2, divisibleBy7)(2) // ⇒  false

function divisibleBy2(d) {
  return d % 2 == 0
}

function divisibleBy7(d) {
  return d % 7 == 0
}