Documentation
dedup

dedup

Removes all duplicates from the wrapped array via the filter/indexOf method. Chunks the wrapped array into smaller arrays of the specified size.

If the number of elements in the wrapped array is not evenly divisible by the specified chunk size, the last chunk will be smaller than the chunk size.

import { iter } from "@tsly/iter";
import { arr } from "@tsly/arr";
 
const chunks = iter.range(1, 10).collectInto(arr).chunk(3).take();
 
console.log(chunks);
// [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]

Edit on CodeSandbox (opens in a new tab)