Example 1 — Official lessThan0 and lessThan2
No item is below 0, but one item is below 2 — the samples from the Ramda docs.
const lessThan0 = R.flip(R.lt)(0);
const lessThan2 = R.flip(R.lt)(2);
console.log(R.any(lessThan0)([1, 2])); // false
console.log(R.any(lessThan2)([1, 2])); // true How It Works
- Build the tests.
R.lt(a, b)meansa < b.R.flipswaps the first two arguments, soR.flip(R.lt)(2)isn => n < 2. - Curry.
R.any(lessThan0)waits for a list, soR.any(lessThan0)(list)equalsR.any(lessThan0, list). - No match. Neither
1nor2is below0, so the first result isfalse. - One match.
1 < 2is true, so the second result istrue.
