🔍
verifica
  • Verifica
  • Getting started
    • 📦Installation
    • 🧑‍🎓 Examples
      • 🧑‍🎓 Basic
      • 🧑‍🎓 Multiple conditions
      • 🧑‍🎓 Optional
      • 🧑‍🎓 Custom rules
      • 🧑‍🎓 With express.js
    • 🟦Typescript
  • Functions
    • asVerificable
    • isValid
    • getErrors
    • ensure
    • rawValue
  • Predicates
    • Built-in Predicates
      • isArray
      • isArrayLength
      • isArrayOf
      • isBoolean
      • isFiniteNumber
      • isInteger
      • isNumber
      • isNumberInRange
      • isObject
      • isOneOf
      • isRegexMatch
      • isString
      • isStringLength
    • Operations on Predicates
      • all
      • optional
    • Custom Predicates
Powered by GitBook
On this page

Was this helpful?

Predicates

Predicates are functions defining validation rules in verifica. Examples are: isString, isNumberInRange, etc.

❓ What are predicates?

Predicates are functions, that define if a value represented by Verificable object matches certain condition. They are then passed into validation methods (i.e. ensure(), getErrors(), isValid()) where the Verificable is checked for matching the Predicate.

Predicate functions can (and should!) be written by you to define your specific validation needs.

There is also a number of Predicate functions built in the library (e.g. isString, isObject, etc.) that can be used to validate simple values, or used within your own custom Predicate functions as building blocks for more complex rules.

PreviousrawValueNextBuilt-in Predicates

Last updated 5 years ago

Was this helpful?