/**
 * Checks whether supplied argument is a TypedArray instance, such as Float32Array
 * @template T
 * @param {T} o
 * @returns {boolean}
 */
export function isTypedArray(o) {
    const t = typeof o;

    if (t !== "object") {
        return false;
    }

    if (o === null) {
        // special case, null is treated as an object
        return false;
    }

    const constructor = o.constructor;

    return (
        constructor === Uint8Array
        || constructor === Uint8ClampedArray
        || constructor === Uint16Array
        || constructor === Uint32Array

        || constructor === Int8Array
        || constructor === Int16Array
        || constructor === Int32Array

        || constructor === Float16Array
        || constructor === Float32Array
        || constructor === Float64Array

        || constructor === BigUint64Array
        || constructor === BigInt64Array
    );
}

