Skip to content

Guard Helpers

Utility functions for working with guard operations.

Function Description
isArray Checks if a value is an array.
isArrayBuffer Checks if a value is an ArrayBuffer instance.
isArrayLike Checks if a value is array-like: has a non-negative integer `length` property.
isAsyncFunction Checks if a value is an async function.
isAsyncGenerator Checks if a value is an async generator object (the result of calling an `async function*`).
isAsyncGeneratorFunction Checks if a value is an async generator function (an `async function*` declaration or expression).
isAsyncIterable Checks if a value implements the async iterable protocol.
isBigInt Checks if a value is a bigint.
isBlob Checks if a value is a Blob instance.
isBoolean Checks if a value is a boolean.
isBrowser Checks whether the code is currently running in a browser-like environment (`window` and `window.document` both defined…
isCssColor Checks whether a value is a syntactically-safe, plain CSS color: a hex color (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`),…
isDate Checks if a value is a Date instance.
isDefined Checks if a value is defined (not undefined nor null).
isError Checks if a value is an Error instance.
isFalsy Checks if a value is falsy (`false`, `null`, `undefined`, `0`, `“”`, `NaN`).
isFormData Checks if a value is a FormData instance.
isFunction Checks if a value is a function.
isGenerator Checks if a value is a generator object (the result of calling a `function*`).
isGeneratorFunction Checks if a value is a generator function (a `function*` declaration or expression).
isIterable Checks if a value is iterable (has a `Symbol.iterator` method).
isJSON Checks whether a value is a string containing valid, parseable JSON text.
isJSONArray Checks whether a value is an array whose every element is a valid JSON value (see isJSONValue).
isJSONObject Checks whether a value is a plain object whose every own value is a valid JSON value (see isJSONValue).
isJSONValue Checks whether a value is composed entirely of JSON-representable types: `string`, finite `number`, `boolean`, `null`, …
isLength Checks whether a value is a valid array-like `length`: a non-negative safe integer (`0 <= value <= Number.MAX_SAFE_INTE…
isMap Checks if a value is a Map instance.
isNode Checks whether the code is currently running in a Node.js-like environment (`process.versions.node` is defined — also t…
isNull Checks if a value is `null`.
isNullish Checks if a value is null or undefined (nullish).
isNumber Checks if a value is a number.
isPlainObject Checks if a value is a plain object.
isPrimitive Checks if a value is a JavaScript primitive.
isPromise Checks if a value is a Promise or a thenable.
isPromiseLike Checks if a value is a thenable (has a `.then()` method).
isPropertyKey Checks if a value is a valid property key: `string`, `number`, or `symbol`.
isRegExp Checks if a value is a RegExp instance.
isSet Checks if a value is a Set instance.
isSpecialObject Determines if a value is a special object that should not have its properties compared deeply.
isString Checks if a value is a string.
isSymbol Checks if a value is a symbol.
isTemporalDuration Checks if a value is a `Temporal.Duration`.
isTemporalInstant Checks if a value is a `Temporal.Instant`.
isTemporalPlainDate Checks if a value is a `Temporal.PlainDate`.
isTemporalPlainDateTime Checks if a value is a `Temporal.PlainDateTime`.
isTemporalPlainTime Checks if a value is a `Temporal.PlainTime`.
isTemporalZonedDateTime Checks if a value is a `Temporal.ZonedDateTime`.
isTimestamp Checks if a value is a valid timestamp (milliseconds or Unix seconds).
isTruthy Checks if a value is truthy (not `false`, `null`, `undefined`, `0`, `“”`, or `NaN`).
isUndefined Checks if a value is `undefined`.
isValidRegex Checks if a string is a valid regex pattern.
isWeakMap Checks if a value is a WeakMap instance.
isWeakSet Checks if a value is a WeakSet instance.