biggerThan
biggerThan :: Number β†’ a β†’ Boolean
Takes a number num and return a new function that evaluates whether the received value is of type number and it's bigger than num (the one previously defined). The evaluation is not inclusive.
import biggerThan from 'deep-waters/biggerThan';
​
const isAdult = biggerThan(17);
​
isTeen(22) // β†’ true
isTeen(18); // β†’ true
isTeen(7); // β†’ false
Please note, biggerThan returned function does not evaluate if the received value is an integer or a float, it only evaluates that it is bigger than the defined one. A good improvement for the isAdult validator from the example above could be the following:
import compose from 'deep-waters/compose';
import biggerThan from 'deep-waters/biggerThan';
​
const isAdult = compose(Number.isInteger, biggerThan(17));
​
Copy link