🔍
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
  • Possible errors:
  • Examples:

Was this helpful?

  1. Predicates
  2. Built-in Predicates

isBoolean

isBoolean

Verifies if provided Verificable represents a boolean value. Only boolean values (true, false) are matching, meaning that 'truthy'/'falsey' values are not matching this Predicate.

Possible errors:

If provided Verificable is not a boolean:

{
    type: "isBoolean",
    path: [/* ... */]
}

Examples:

Each of examples uses this import statement:

const { asVerificable, isValid, isBoolean } = require("verifica");

Null or undefined is not considered a boolean:

const verificable = asVerificable(null);
isValid(verificable, isBoolean); // false

String value is not considered a boolean as well:

const verificable = asVerificable("true");
isValid(verificable, isBoolean); // false

true and false are considered boolean values:

const verificable = asVerificable(false);
isValid(verificable, isBoolean); // true
PreviousisArrayOfNextisFiniteNumber

Last updated 5 years ago

Was this helpful?