import { DataTypeIndices } from "./DataTypeIndices.js";

/**
 *
 * @param {number} index
 * @returns {BinaryDataType|undefined}
 */
export function computeDataTypeByIndex(index) {
    for (let type in DataTypeIndices) {
        if (!DataTypeIndices.hasOwnProperty(type)) {
            continue;
        }

        const typeIndex = DataTypeIndices[type];
        if (typeIndex === index) {
            return type;
        }
    }

    return undefined;
}
