Function isArrayBuffer

  • Checks if a given value is ArrayBuffer.

    This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to ArrayBuffer.

    Parameters

    • value: unknown

      The value to check if it is a ArrayBuffer.

    Returns value is ArrayBuffer

    Returns true if value is a ArrayBuffer, else false.

    const value1 = new ArrayBuffer();
    const value2 = new Array();
    const value3 = new Map();

    console.log(isArrayBuffer(value1)); // true
    console.log(isArrayBuffer(value2)); // false
    console.log(isArrayBuffer(value3)); // false