🌊
Deep Waters
  • What is Deep Waters
  • 📌Getting started
    • Installation
  • 🍰Composition
    • compose
    • when
    • or
    • not
  • 👁️ Validators
    • arrayOf
    • arrayOfShape
    • between
    • biggerThan
    • contains
    • equals
    • every
    • hasProp
    • hasShape
    • isCreditCard
      • isVISA
      • isMastercard
      • isAmericanExpress
      • isDinersClub
      • isDiscover
      • isJCB
    • isDateFormat [TD]
    • isDivisibleBy [TD]
    • isEmail [TD]
    • isEmpty [TD]
    • isEmptyString [TD]
    • isIP [TD]
      • isIPv6 [TD]
      • isIPv4 [TD]
    • isNumeric [TD]
    • isPhone [TD]
    • isPrimitive [TD]
    • isRequired [TD]
    • isURL [TD]
    • matchesPattern [TD]
    • maxLenght [TD]
    • minLength [TD]
    • ofLength [TD]
    • ofUniqueItems [TD]
    • ofClass
    • oneOfValues [TD]
    • smallerThan
  • ✅Type validators
    • isBigInt
    • isBoolean
    • isBuffer
    • isDate
    • isError
    • isFunction
    • isInt8Array
    • isMap
    • isNull
    • isNumber
    • isObject
    • isRegExp
    • isSet
    • isString
    • isSymbol
    • isUint8Array
    • isUndefined
    • isWeakMap
    • isWeakSet
  • github repository
Powered by GitBook
On this page

Was this helpful?

  1. 👁️ Validators

biggerThan

biggerThan :: Number → a → Boolean

PreviousbetweenNextcontains

Last updated 5 years ago

Was this helpful?

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));

Related validators

isNumber
between
smallerThan