Skip to content

Guard Helpers

Utility functions for working with guard operations.

FunctionDescription
isArrayChecks if a value is an array.
isArrayBufferChecks if a value is an ArrayBuffer instance.
isArrayLikeChecks if a value is array-like: has a non-negative integer length property.
isAsyncFunctionChecks if a value is an async function.
isAsyncGeneratorChecks if a value is an async generator object (the result of calling an async function*).
isAsyncGeneratorFunctionChecks if a value is an async generator function (an async function* declaration or expression).
isAsyncIterableChecks if a value implements the async iterable protocol.
isBigIntChecks if a value is a bigint.
isBlobChecks if a value is a Blob instance.
isBooleanChecks if a value is a boolean.
isCssColorChecks whether a value is a syntactically-safe, plain CSS color: a hex color (#rgb, #rgba, #rrggbb, #rrggbbaa
isDateChecks if a value is a Date instance.
isDefinedChecks if a value is defined (not undefined nor null).
isErrorChecks if a value is an Error instance.
isFalsyChecks if a value is falsy (false, null, undefined, 0, "", NaN).
isFormDataChecks if a value is a FormData instance.
isFunctionChecks if a value is a function.
isGeneratorChecks if a value is a generator object (the result of calling a function*).
isGeneratorFunctionChecks if a value is a generator function (a function* declaration or expression).
isIterableChecks if a value is iterable (has a Symbol.iterator method).
isMapChecks if a value is a Map instance.
isNullChecks if a value is null.
isNullishChecks if a value is null or undefined (nullish).
isNumberChecks if a value is a number.
isPlainObjectChecks if a value is a plain object.
isPrimitiveChecks if a value is a JavaScript primitive.
isPromiseChecks if a value is a Promise or a thenable.
isPromiseLikeChecks if a value is a thenable (has a .then() method).
isPropertyKeyChecks if a value is a valid property key: string, number, or symbol.
isRegExpChecks if a value is a RegExp instance.
isSpecialObjectDetermines if a value is a special object that should not have its properties compared deeply.
isStringChecks if a value is a string.
isSymbolChecks if a value is a symbol.
isTemporalDurationChecks if a value is a Temporal.Duration.
isTemporalInstantChecks if a value is a Temporal.Instant.
isTemporalPlainDateChecks if a value is a Temporal.PlainDate.
isTemporalPlainDateTimeChecks if a value is a Temporal.PlainDateTime.
isTemporalPlainTimeChecks if a value is a Temporal.PlainTime.
isTemporalZonedDateTimeChecks if a value is a Temporal.ZonedDateTime.
isTimestampChecks if a value is a valid timestamp (milliseconds or Unix seconds).
isTruthyChecks if a value is truthy (not false, null, undefined, 0, "", or NaN).
isUndefinedChecks if a value is undefined.
isValidRegexChecks if a string is a valid regex pattern.