check

Array

inArray

Checks if a value is in an array.

import { inArray } from '@jonibach/check'

const result = inArray(3,1,2,3,4,5)

params:

  1. value

  2. array

async: no

Demo not found

inArray

Checks if a value is in an array.

import { inArray } from '@jonibach/check'

const result = inArray(3,1,2,3,4,5)

params:

  1. value

  2. array

async: no

Demo not found

notInArray

Checks if a value is not in an array.

import { notInArray } from '@jonibach/check'

const result = notInArray(6,1,2,3,4,5)

params:

  1. value

  2. array

async: no

Demo not found

empty

Checks if an array is empty.

import { empty } from '@jonibach/check'

const result = empty(,)

params:

  1. array

async: no

Demo not found

notEmpty

Checks if an array is not empty.

import { notEmpty } from '@jonibach/check'

const result = notEmpty(1,2,)

params:

  1. array

async: no

Demo not found

Comparison

isEqualTo

Checks if two values are equal.

import { isEqualTo } from '@jonibach/check'

const result = isEqualTo(5,5)

params:

  1. a

  2. b

async: no

Demo not found

isNotEqualTo

Checks if two values are not equal.

import { isNotEqualTo } from '@jonibach/check'

const result = isNotEqualTo(5,10)

params:

  1. a

  2. b

async: no

Demo not found

isGreaterThan

Checks if a value is greater than another value.

import { isGreaterThan } from '@jonibach/check'

const result = isGreaterThan(10,5)

params:

  1. a

  2. b

async: no

Demo not found

isLessThan

Checks if a value is less than another value.

import { isLessThan } from '@jonibach/check'

const result = isLessThan(5,10)

params:

  1. a

  2. b

async: no

Demo not found

isGreaterThanOrEqualTo

Checks if a value is greater than or equal to another value.

import { isGreaterThanOrEqualTo } from '@jonibach/check'

const result = isGreaterThanOrEqualTo(10,10)

params:

  1. a

  2. b

async: no

Demo not found

isLessThanOrEqualTo

Checks if a value is less than or equal to another value.

import { isLessThanOrEqualTo } from '@jonibach/check'

const result = isLessThanOrEqualTo(5,5)

params:

  1. a

  2. b

async: no

Demo not found

isStrictlyEqualTo

Checks if two values are strictly equal.

import { isStrictlyEqualTo } from '@jonibach/check'

const result = isStrictlyEqualTo(5,5)

params:

  1. a

  2. b

async: no

Demo not found

isStrictlyNotEqualTo

Checks if two values are strictly not equal.

import { isStrictlyNotEqualTo } from '@jonibach/check'

const result = isStrictlyNotEqualTo(5,5)

params:

  1. a

  2. b

async: no

Demo not found

String

startsWith

Checks if a string starts with another string.

import { startsWith } from '@jonibach/check'

const result = startsWith(Hello!,Hel)

params:

  1. str

  2. substring

async: no

Demo not found

endsWith

Checks if a string ends with another string.

import { endsWith } from '@jonibach/check'

const result = endsWith(Hello!,world!)

params:

  1. str

  2. substring

async: no

Demo not found

contains

Checks if a string contains another string.

import { contains } from '@jonibach/check'

const result = contains(Hello!,lo, wo)

params:

  1. str

  2. substring

async: no

Demo not found

matches

Checks if a string matches a regular expression.

import { matches } from '@jonibach/check'

const result = matches(Hello!,/world!$/)

params:

  1. str

  2. regex

async: no

Demo not found

regex

Checks if a string matches a regular expression.

import { regex } from '@jonibach/check'

const result = regex(Hello!,/world!$/)

params:

  1. str

  2. regex

async: no

Demo not found

lengthEquals

Checks if a string has a specific length.

import { lengthEquals } from '@jonibach/check'

const result = lengthEquals(Hello,5)

params:

  1. str

  2. length

async: no

Demo not found

lengthGreaterThan

Checks if a string has a length greater than a specific value.

import { lengthGreaterThan } from '@jonibach/check'

const result = lengthGreaterThan(Hello!,5)

params:

  1. str

  2. length

async: no

Demo not found

lengthLessThan

Checks if a string has a length less than a specific value.

import { lengthLessThan } from '@jonibach/check'

const result = lengthLessThan(Hi,5)

params:

  1. str

  2. length

async: no

Demo not found

validURL

Checks if a string is a valid URL.

import { validURL } from '@jonibach/check'

const result = validURL(https://www.example,)

params:

  1. str

async: no

Demo not found

validEmail

Checks if a string is a valid email address.

import { validEmail } from '@jonibach/check'

const result = validEmail(email@example,)

params:

  1. email

async: no

Demo not found

domainMatches

Checks if a string is a valid domain.

import { domainMatches } from '@jonibach/check'

const result = domainMatches(https://www.example,www.example.com)

params:

  1. url

  2. domain

async: no

Demo not found

Logic

and

Checks if all values are true.

import { and } from '@jonibach/check'

const result = and(true,true)

params:

  1. ...conditions

async: no

Demo not found

or

Checks if any value is true.

import { or } from '@jonibach/check'

const result = or(false,false)

params:

  1. ...conditions

async: no

Demo not found

not

Checks if a value is false.

import { not } from '@jonibach/check'

const result = not(false,)

params:

  1. condition

async: no

Demo not found

xor

Checks if exactly one value is true.

import { xor } from '@jonibach/check'

const result = xor(true,false)

params:

  1. condition1

  2. condition2

async: no

Demo not found

nand

Checks if neither value is true.

import { nand } from '@jonibach/check'

const result = nand(true,true)

params:

  1. condition1

  2. condition2

async: no

Demo not found

nor

Checks if neither value is true.

import { nor } from '@jonibach/check'

const result = nor(false,false)

params:

  1. condition1

  2. condition2

async: no

Demo not found

Numeric

even

Checks if a number is even.

import { even } from '@jonibach/check'

const result = even(4)

params:

  1. number

async: no

Demo not found

odd

Checks if a number is odd.

import { odd } from '@jonibach/check'

const result = odd(5)

params:

  1. number

async: no

Demo not found

divisibleBy

Checks if a number is divisible by another number.

import { divisibleBy } from '@jonibach/check'

const result = divisibleBy(10,2)

params:

  1. number

  2. divisor

async: no

Demo not found

Existence

exists

Checks if a value exists.

import { exists } from '@jonibach/check'

const result = exists()

params:

  1. value

async: no

Demo not found

doesNotExist

Checks if a value does not exist.

import { doesNotExist } from '@jonibach/check'

const result = doesNotExist()

params:

  1. value

async: no

Demo not found

Date

before

Checks if a date is before another date.

import { before } from '@jonibach/check'

const result = before(Wed Jan 01 2020 00:00:00 GMT+0000 (Coordinated Universal Time),Thu Jan 02 2020 00:00:00 GMT+0000 (Coordinated Universal Time))

params:

  1. date1

  2. date2

async: no

Demo not found

after

Checks if a date is after another date.

import { after } from '@jonibach/check'

const result = after(Wed Jan 01 2020 00:00:00 GMT+0000 (Coordinated Universal Time),Wed Jan 01 2020 00:00:00 GMT+0000 (Coordinated Universal Time))

params:

  1. date1

  2. date2

async: no

Demo not found

betweenDates

Checks if a date is between two dates.

import { betweenDates } from '@jonibach/check'

const result = betweenDates(Wed Jan 01 2020 00:00:00 GMT+0000 (Coordinated Universal Time),Wed Jan 01 2020 00:00:00 GMT+0000 (Coordinated Universal Time),Fri Jan 03 2020 00:00:00 GMT+0000 (Coordinated Universal Time))

params:

  1. date

  2. startDate

  3. endDate

async: no

Demo not found

sameDay

Checks if two dates are on the same day.

import { sameDay } from '@jonibach/check'

const result = sameDay(Wed Jan 01 2020 00:00:00 GMT+0000 (Coordinated Universal Time),Wed Jan 01 2020 00:00:00 GMT+0000 (Coordinated Universal Time))

params:

  1. date1

  2. date2

async: no

Demo not found

Object/Key

keyExists

Checks if a key exists in an object.

import { keyExists } from '@jonibach/check'

const result = keyExists([object Object],hello)

params:

  1. obj

  2. key

async: no

Demo not found

keyDoesNotExist

Checks if a key does not exist in an object.

import { keyDoesNotExist } from '@jonibach/check'

const result = keyDoesNotExist([object Object],world)

params:

  1. obj

  2. key

async: no

Demo not found

Misc

checkType

Checks if a value is of a specific type.

import { checkType } from '@jonibach/check'

const result = checkType(Hello,string)

params:

  1. value

  2. type

async: no

Demo not found