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.
isBrowserChecks whether the code is currently running in a browser-like environment (`window` and `window.document` both defin…
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).
isJSONChecks whether a value is a string containing valid, parseable JSON text.
isJSONArrayChecks whether a value is an array whose every element is a valid JSON value (see isJSONValue).
isJSONObjectChecks whether a value is a plain object whose every own value is a valid JSON value (see isJSONValue).
isJSONValueChecks whether a value is composed entirely of JSON-representable types: `string`, finite `number`, `boolean`, `null`…
isLengthChecks whether a value is a valid array-like `length`: a non-negative safe integer (`0 <= value <= Number.MAX_SAFE_IN…
isMapChecks if a value is a Map instance.
isNodeChecks whether the code is currently running in a Node.js-like environment (`process.versions.node` is defined — also…
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.
isSetChecks if a value is a Set 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.
isWeakMapChecks if a value is a WeakMap instance.
isWeakSetChecks if a value is a WeakSet instance.