is
defined
Signature
defined(value)Description
Check if a value is defined (not null or undefined).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is not null and not undefined |
Examples
is.defined(0) // true
is.defined('') // true
is.defined(null) // false
is.defined(undefined) // falsenil
Signature
nil(value)Description
Check if a value is null or undefined.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is null or undefined |
Examples
is.nil(null) // true
is.nil(undefined) // true
is.nil(0) // false
is.nil('') // falseplainObject
Signature
plainObject(value)Description
Check if a value is a plain object literal (not an array, not null, not a class instance).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a plain object literal |
Examples
is.plainObject({}) // true
is.plainObject({ name: 'Alice' }) // true
is.plainObject([]) // false
is.plainObject(null) // false
is.plainObject(new Date()) // falseemptyObject
Signature
emptyObject(value)Description
Check if a value is a plain object with no keys.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a plain object with no keys |
Examples
is.emptyObject({}) // true
is.emptyObject({ name: 'Alice' }) // false
is.emptyObject([]) // falsenonEmptyObject
Signature
nonEmptyObject(value)Description
Check if a value is a plain object with at least one key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a plain object with at least one key |
Examples
is.nonEmptyObject({ name: 'Alice' }) // true
is.nonEmptyObject({}) // false
is.nonEmptyObject([]) // falsestring
Signature
string(value)Description
Check if a value is a string.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a string |
Examples
is.string('hello') // true
is.string('') // true
is.string(123) // falseemptyString
Signature
emptyString(value)Description
Check if a value is a string containing only whitespace.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a string with only whitespace |
Examples
is.emptyString('') // true
is.emptyString(' ') // true
is.emptyString('hello') // false
is.emptyString(null) // falsenonEmptyString
Signature
nonEmptyString(value)Description
Check if a value is a string containing at least one non-whitespace character.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a string with at least one non-whitespace character |
Examples
is.nonEmptyString('hello') // true
is.nonEmptyString('') // false
is.nonEmptyString(' ') // false
is.nonEmptyString(null) // falseregularExpression
Signature
regularExpression(value)Description
Check if a value is a regular expression (instance of RegExp).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a RegExp instance |
Examples
is.regularExpression(/abc/) // true
is.regularExpression(new RegExp('abc')) // true
is.regularExpression('abc') // false
is.regularExpression(null) // falsenumber
Signature
number(value)Description
Check if a value is a valid finite number (not NaN, not Infinity).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a finite number |
Examples
is.number(42) // true
is.number(3.14) // true
is.number(NaN) // false
is.number(Infinity) // false
is.number('42') // falsepositive
Signature
positive(value)Description
Check if a value is a positive number (strictly greater than 0).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a number greater than 0 |
Examples
is.positive(5) // true
is.positive(0.1) // true
is.positive(0) // false
is.positive(-5) // falsenonPositive
Signature
nonPositive(value)Description
Check if a value is a number less than or equal to 0.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a number ≤ 0 |
Examples
is.nonPositive(0) // true
is.nonPositive(-5) // true
is.nonPositive(1) // falsenegative
Signature
negative(value)Description
Check if a value is a negative number (strictly less than 0).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a number less than 0 |
Examples
is.negative(-5) // true
is.negative(-0.1) // true
is.negative(0) // false
is.negative(5) // falsenonNegative
Signature
nonNegative(value)Description
Check if a value is a number greater than or equal to 0.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a number ≥ 0 |
Examples
is.nonNegative(0) // true
is.nonNegative(5) // true
is.nonNegative(-1) // falseinRange
Signature
inRange(value, min, max)Description
Check if a value is within a numeric range (inclusive on both ends).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
| min | number | yes | Minimum value (inclusive) |
| max | number | yes | Maximum value (inclusive) |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a number between min and max (inclusive) |
Examples
is.inRange(5, 1, 10) // true
is.inRange(1, 1, 10) // true
is.inRange(10, 1, 10) // true
is.inRange(0, 1, 10) // false
is.inRange(11, 1, 10) // falseinRangeExclusive
Signature
inRangeExclusive(value, min, max)Description
Check if a value is strictly within a numeric range (exclusive on both ends).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
| min | number | yes | Minimum value (exclusive) |
| max | number | yes | Maximum value (exclusive) |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a number strictly between min and max |
Examples
is.inRangeExclusive(5, 1, 10) // true
is.inRangeExclusive(1, 1, 10) // false
is.inRangeExclusive(10, 1, 10) // falseinRangeExclusiveMin
Signature
inRangeExclusiveMin(value, min, max)Description
Check if a value is within a numeric range, exclusive on the lower bound and inclusive on the upper bound.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
| min | number | yes | Minimum value (exclusive) |
| max | number | yes | Maximum value (inclusive) |
Returns
| Type | Description |
|---|---|
boolean | True if min < value <= max |
Examples
is.inRangeExclusiveMin(10, 1, 10) // true
is.inRangeExclusiveMin(1, 1, 10) // false
is.inRangeExclusiveMin(5, 1, 10) // trueinRangeExclusiveMax
Signature
inRangeExclusiveMax(value, min, max)Description
Check if a value is within a numeric range, inclusive on the lower bound and exclusive on the upper bound.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
| min | number | yes | Minimum value (inclusive) |
| max | number | yes | Maximum value (exclusive) |
Returns
| Type | Description |
|---|---|
boolean | True if min <= value < max |
Examples
is.inRangeExclusiveMax(1, 1, 10) // true
is.inRangeExclusiveMax(10, 1, 10) // false
is.inRangeExclusiveMax(5, 1, 10) // trueinteger
Signature
integer(value)Description
Check if a value is an integer.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an integer |
Examples
is.integer(42) // true
is.integer(0) // true
is.integer(3.14) // false
is.integer('42') // falsepositiveInteger
Signature
positiveInteger(value)Description
Check if a value is an integer strictly greater than 0.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an integer > 0 |
Examples
is.positiveInteger(1) // true
is.positiveInteger(42) // true
is.positiveInteger(0) // false
is.positiveInteger(-1) // false
is.positiveInteger(3.14) // falsenonPositiveInteger
Signature
nonPositiveInteger(value)Description
Check if a value is an integer less than or equal to 0.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an integer ≤ 0 |
Examples
is.nonPositiveInteger(0) // true
is.nonPositiveInteger(-3) // true
is.nonPositiveInteger(1) // falsenegativeInteger
Signature
negativeInteger(value)Description
Check if a value is an integer strictly less than 0.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an integer < 0 |
Examples
is.negativeInteger(-1) // true
is.negativeInteger(-42) // true
is.negativeInteger(0) // false
is.negativeInteger(1) // falsenonNegativeInteger
Signature
nonNegativeInteger(value)Description
Check if a value is an integer greater than or equal to 0.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an integer ≥ 0 |
Examples
is.nonNegativeInteger(0) // true
is.nonNegativeInteger(5) // true
is.nonNegativeInteger(-1) // falsearray
Signature
array(value)Description
Check if a value is an array.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an array |
Examples
is.array([]) // true
is.array([1, 2, 3]) // true
is.array({}) // false
is.array('hello') // falseemptyArray
Signature
emptyArray(value)Description
Check if a value is an empty array.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an array with no elements |
Examples
is.emptyArray([]) // true
is.emptyArray([1, 2]) // false
is.emptyArray({}) // falsenonEmptyArray
Signature
nonEmptyArray(value)Description
Check if a value is an array with at least one element.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an array with at least one element |
Examples
is.nonEmptyArray([1, 2]) // true
is.nonEmptyArray([]) // falsearrayOfLength
Signature
arrayOfLength(value, length)Description
Check if a value is an array of a specific length.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
| length | number | yes | The expected length |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an array with the specified length |
Examples
is.arrayOfLength([1, 2, 3], 3) // true
is.arrayOfLength([1, 2], 3) // false
is.arrayOfLength([], 0) // truearrayOfLengthAtLeast
Signature
arrayOfLengthAtLeast(value, minLength)Description
Check if a value is an array with at least a given number of elements.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
| minLength | number | yes | Minimum number of elements (inclusive) |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an array with length >= minLength |
Examples
is.arrayOfLengthAtLeast([1, 2, 3], 3) // true
is.arrayOfLengthAtLeast([1, 2, 3], 2) // true
is.arrayOfLengthAtLeast([1], 2) // falsearrayOfLengthAtMost
Signature
arrayOfLengthAtMost(value, maxLength)Description
Check if a value is an array with at most a given number of elements.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
| maxLength | number | yes | Maximum number of elements (inclusive) |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an array with length <= maxLength |
Examples
is.arrayOfLengthAtMost([1, 2], 3) // true
is.arrayOfLengthAtMost([1, 2], 2) // true
is.arrayOfLengthAtMost([1, 2, 3], 2) // falsearrayOfLengthBetween
Signature
arrayOfLengthBetween(value, minLength, maxLength)Description
Check if a value is an array whose length falls within a given range (inclusive on both ends).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
| minLength | number | yes | Minimum number of elements (inclusive) |
| maxLength | number | yes | Maximum number of elements (inclusive) |
Returns
| Type | Description |
|---|---|
boolean | True if the value is an array with minLength <= length <= maxLength |
Examples
is.arrayOfLengthBetween([1, 2], 1, 3) // true
is.arrayOfLengthBetween([1, 2, 3], 1, 3) // true
is.arrayOfLengthBetween([], 1, 3) // false
is.arrayOfLengthBetween([1, 2, 3, 4], 1, 3) // falsemap
Signature
map(value)Description
Check if a value is a Map instance.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a Map instance |
Examples
is.map(new Map()) // true
is.map(new Map([['a', 1]])) // true
is.map({}) // false
is.map(null) // falseemptyMap
Signature
emptyMap(value)Description
Check if a value is a Map instance with no entries.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a Map with no entries |
Examples
is.emptyMap(new Map()) // true
is.emptyMap(new Map([['a', 1]])) // falsenonEmptyMap
Signature
nonEmptyMap(value)Description
Check if a value is a Map instance with at least one entry.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a Map with at least one entry |
Examples
is.nonEmptyMap(new Map([['a', 1]])) // true
is.nonEmptyMap(new Map()) // falseset
Signature
set(value)Description
Check if a value is a Set instance.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a Set instance |
Examples
is.set(new Set()) // true
is.set(new Set([1, 2])) // true
is.set([]) // false
is.set(null) // falseemptySet
Signature
emptySet(value)Description
Check if a value is a Set instance with no elements.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a Set with no elements |
Examples
is.emptySet(new Set()) // true
is.emptySet(new Set([1, 2])) // falsenonEmptySet
Signature
nonEmptySet(value)Description
Check if a value is a Set instance with at least one element.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a Set with at least one element |
Examples
is.nonEmptySet(new Set([1, 2])) // true
is.nonEmptySet(new Set()) // falsefunction
Signature
function(value)Description
Check if a value is a function.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a function |
Examples
is.function(() => {}) // true
is.function(function() {}) // true
is.function(Array.isArray) // true
is.function({}) // falseboolean
Signature
boolean(value)Description
Check if a value is a boolean.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is a boolean |
Examples
is.boolean(true) // true
is.boolean(false) // true
is.boolean(1) // false
is.boolean('true') // falseoneOf
Signature
oneOf(value, allowedValues)Description
Check if a value is one of the allowed values.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
| allowedValues | Array | yes | Array of allowed values |
Returns
| Type | Description |
|---|---|
boolean | True if the value is included in allowedValues |
Examples
is.oneOf('red', ['red', 'green', 'blue']) // true
is.oneOf('yellow', ['red', 'green', 'blue']) // false
is.oneOf(2, [1, 2, 3]) // trueempty
Signature
empty(value)Description
Check if a value is empty. A value is considered empty if it is null, undefined, a whitespace-only string, an empty array, an empty object, an empty Map, or an empty Set.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
value | * | yes | The value to check |
Returns
| Type | Description |
|---|---|
boolean | True if the value is considered empty |
Examples
is.empty(null) // true
is.empty(undefined) // true
is.empty('') // true
is.empty(' ') // true
is.empty([]) // true
is.empty({}) // true
is.empty(new Map()) // true
is.empty(new Set()) // true
is.empty(0) // false
is.empty(false) // false
is.empty('hello') // false