import { Struct , StructResult } from './dataTypes' ; param dataView param struct param byteOffset returns export const readStruct = function < S extends Struct > ( dataView , struct , byteOffset = 0 ) : StructResult < S > { let offset = byteOffset ; const structResult = { } as StructResult < S > ; for ( const key in struct ) { ; ( structResult as any ) [ key ] = struct [ key ] . getValue ( dataView , offset ) ; offset += struct [ key ] . byteLength ; } return structResult ; } ; todo param dataView param struct param byteOffset param times returns export const readStructMultiple = function < S extends Struct > ( dataView , struct , byteOffset = 0 , times = 1 ) : StructResult < S > [ ] { let offset = byteOffset ; const result = [ ] ; for ( let i = 0 ; i < times ; i ++ ) { const structResult = { } as StructResult < S > ; for ( const key in struct ) { ; ( structResult as any ) [ key ] = struct [ key ] . getValue ( dataView , offset ) ; offset += struct [ key ] . byteLength ; } result [ i ] = structResult ; } return result ; } ; param struct export const getStructLength = < S extends Struct > ( struct ) : number => { let length = 0 ; for ( const key in struct ) { length += struct [ key ] . byteLength ; } return length ; } ;