Skip to content

isArrayBuffer

isArrayBuffer is a function that determines whether a given value is an ArrayBuffer object.

Import

import { isArrayBuffer } from "@tai-kun/surrealdb/utils";

Usage

function isArrayBuffer(value: unknown): value is ArrayBuffer;

Argument

value

The value expected to be an ArrayBuffer object.

Return Value

Returns true if value is an ArrayBuffer object; otherwise, returns false.

Explanation

In some versions of Firefox, when the response body of fetch is an ArrayBuffer object, it may possess methods but not be correctly identified by instanceof. Therefore, this function uses tag name checking for determination. This approach is similar to the behavior of lodash.