import { Nibble , UInt4 } from '../types' ; example param { Array } nibble return { Number } export default ( nibble ) : UInt4 => { if ( ! Array . isArray ( nibble ) || nibble . length !== 4 ) throw new RangeError ( 'invalid array length' ) ; let result = 0 ; for ( let i = 0 ; i < 4 ; i ++ ) if ( nibble [ 3 - i ] ) result |= 1 << i ; return < UInt4 > result ; } ;