license export const batch = < T > ( target , batchSize , offset = 0 ) : T [ ] [ ] => { return target . reduce ( ( res , item , index ) : T [ ] => { const chunkIndex = Math . floor ( ( index + offset ) / batchSize ) ; if ( ! res [ chunkIndex ] ) { res [ chunkIndex ] = [ ] ; } res [ chunkIndex ] . push ( item ) ; return res ; } , [ ] ) ; } ; /**
 * returns array with numbers from zero to bound.
 * */ export const range = < T > ( bound , producer = i => i ) => { const arr = [ ] ; for ( let i = 0 ; i < bound ; i ++ ) { arr . push ( producer ( i ) ) ; } return arr ; } ;