import { Bits } from '../types' ; example see https param { Array } bits param { number } amount return { Array } export default ( bits , amount ) : Bits => { const result = [ ] ; if ( amount > bits . length ) throw new Error ( 'shift amount can’t be larger than bits array length' ) ; for ( let i = 0 ; i < bits . length ; i ++ ) result [ ( i + amount ) % bits . length ] = bits [ i ] ; return result ; } ;