/**
 * Utility types and functions for working with JavaScript TypedArrays.
 *
 * - TypedIntArray: All integer TypedArray types.
 * - TypedFloatArray: All floating-point TypedArray types.
 * - TypedArray: Union of all supported TypedArray types.
 * - isTypedArray: Type guard for TypedArray (excluding DataView).
 * - isNumberArray: Type guard for number[] arrays.
 * - TConstructor: Generic constructor type for TypedArrays.
 * - toTypedArray: Converts number[] or TypedArray to a specific TypedArray type.
 */
/**
 * Type guard: Returns true if value is a TypedArray (but not DataView).
 */
export function isTypedArray(value) {
    return ArrayBuffer.isView(value) && !(value instanceof DataView);
}
/**
 * Type guard: Returns true if value is an array of numbers.
 */
export function isNumberArray(value) {
    return (Array.isArray(value) &&
        (value.length === 0 || typeof value[0] === "number"));
}
/**
 * Converts a number[] or TypedArray to a specific TypedArray type.
 * If the input is already of the correct type, it is returned as-is.
 *
 * @param data - The input data (number[] or TypedArray)
 * @param type - The targeted TypedArray (e.g., Float32Array)
 * @returns The data as the specified TypedArray type
 */
export function toTypedArray(data, type) {
    if (data instanceof type) {
        return data;
    }
    return new type(data);
}
//# sourceMappingURL=typedArray.js.map