Guards
Overview
Guards are functions that are used to check if a value meets certain criteria. They are often used in conjunction with other functions or methods to ensure that the input is valid before proceeding.
Satisfies type FnGuard
Basic guards
These guards filters the only one simple type
isNumber
- the same astypeof value === 'number'
isString
- the same astypeof value === 'string'
isBoolean
- the same astypeof value === 'boolean'
isSymbol
- the same astypeof value === 'symbol'
isBigInt
- the same astypeof value === 'bigint'
isArray
- the same asArray.isArray(value)
isObject
- checks if the value is an object and not null
Aliases guards
These guards filters the set of types
isFalsy
- checks if the value is falsy (false, 0, '', null, undefined)isNullish
- checks if the value is null or undefinedisNumeric
- checks if the value is a number or bigintisCollection
- checks if the value is an array or objectisPrimitive
- checks if the value is a primitive type (number, string, boolean, symbol, bigint, null, undefined)