Docs
/
validators

Validators

A collection of validators for common data types

isEmail

Link Copied!

Check if any given value is a valid email address.

true
Result
isEmail(value: string)

isNumber

Link Copied!

Check if any given value is a valid number.

false
Result
isNumber(value: unknown)

isUrl

Link Copied!

Check if any given value is a valid URL.

true
Result
isUrl(value: string)

isEmpty

Link Copied!

Check if any given string, array or object is empty.

true
Result
isEmpty(value: string | string[] | number[] | object | null | undefined)

isUuid

Link Copied!

Check if any given value is a valid UUID.

true
Result
isUuid(value: unknown)

isJson

Link Copied!

Check if any given value is a valid JSON string.

true
Result
isJson(value: unknown)

isObject

Link Copied!

Check if any given value is an object.

true
Result
isObject(value: unknown)

isArray

Link Copied!

Check if any given value is an array.

true
Result
isArray(value: string[] | number[])

isHex

Link Copied!

Check if any given value is a valid hexadecimal color code.

true
Result
isHex(value: string)

::page-function{name="isAlphabetic" description="Check if any given value contains only alphabetic characters." params=" value: string | number | string | number " }

true
Result

::

isAlphanumeric

Link Copied!

Check if any given value contains only alphanumeric characters.

true
Result
isAlphanumeric(value: string)

isBoolean

Link Copied!

Check if any given value is a boolean value.

true
Result
isBoolean(value: boolean)

isUndefined

Link Copied!

Check if any given value is undefined.

true
Result
isUndefined(value: undefined)

isNull

Link Copied!

Check if any given value is null.

true
Result
isNull(value: null)

::page-function{name="isDate" description="Check if any given value is a valid Date object." params=" value: Date | string | number | string | number " }

true
Result

::

isTime

Link Copied!

Check if any given value is a valid time in HH:mm format.

true
Result
isTime(value: string)

isLeapYear

Link Copied!

Check if any given value year is a leap year.

true
Result
isLeapYear(value: number)

isEven

Link Copied!

Check if the number is even.

true
Result
isEven(value: number)

isOdd

Link Copied!

Check if the number is odd.

true
Result
isOdd(value: number)

isPositive

Link Copied!

Check if the number is positive.

true
Result
isPositive(value: number)

isNegative

Link Copied!

Check if the number is negative.

true
Result
isNegative(value: number)

isZero

Link Copied!

Check if the number is zero.

true
Result
isZero(value: number)

isOver9000

Link Copied!

Check if the number is over 9000.

false
Result
isOver9000(value: number)

isPrime

Link Copied!

Check if the number is a prime number.

false
Result
isPrime(value: number)

isInteger

Link Copied!

Check if the number is an integer.

true
Result
isInteger(value: unknown)

isFloat

Link Copied!

Check if the number is a float.

true
Result
isFloat(value: unknown)

isBetween

Link Copied!

Check if the number is between the specified range.

false
Result
isBetween(value: number, min: number, max: number)

isDivisibleBy

Link Copied!

Check if the number is divisible by the specified number.

true
Result
isDivisibleBy(value: number, divisor: number)

isCreditCard

Link Copied!

Check if any given value is a valid credit card number.

true
Result
isCreditCard(value: unknown)

isLatLng

Link Copied!

Check if any given value is a valid latitude-longitude coordinate in the format lat,lng or lat,lng.

true
Result
isLatLng(value: string)

isLatitude

Link Copied!

Check if any given value is a valid latitude coordinate.

true
Result
isLatitude(value: string)

isLongitude

Link Copied!

Check if any given value is a valid longitude coordinate.

true
Result
isLongitude(value: string)

isIpAddress

Link Copied!

Check if any given value is a valid IP address.

isIpAddress(value: string)

isPort

Link Copied!

Check if any given value is a valid port number.

true
Result
isPort(value: number)

isMacAddress

Link Copied!

Check if any given value is a valid MAC address.

true
Result
isMacAddress(value: string)