import { isIterable } from "@thi.ng/checks/is-iterable" ; import type { Transducer } from "./api.js" ; import { iterator } from "./iterator.js" ; import { partitionBy } from "./partition-by.js" ; example param sizes export function partitionOf < T > ( sizes ) ; export function partitionOf < T > ( sizes , src ) ; export function partitionOf < T > ( sizes , src ? ) { return isIterable ( src ) ? iterator ( partitionOf ( sizes ) , src ) : partitionBy ( ( ) => { let i = 0 , j = 0 ; return ( ) => { if ( i ++ === sizes [ j ] ) { i = 1 ; j = ( j + 1 ) % sizes . length ; } return j ; } ; } , true ) ; }