import { Byte , UInt8 } from '../types' ; example param { Array } byte return { Number } export default ( byte ) : UInt8 => { if ( ! Array . isArray ( byte ) || byte . length !== 8 ) throw new RangeError ( 'invalid array length' ) ; let data = 0 ; for ( let i = 0 ; i < 8 ; i ++ ) if ( byte [ 7 - i ] ) data |= 1 << i ; return < UInt8 > data ; } ;