const fromBinary = ( binary ) => { return parseInt ( binary . join ( '' ) , 2 ) ; } ; export const splitIntoCodewords = ( data ) : number [ ] => { if ( data . length <= 8 ) { return [ fromBinary ( data ) ] ; } return [ fromBinary ( data . slice ( 0 , 8 ) ) , ... splitIntoCodewords ( data . slice ( 8 ) ) ] ; } ;