starry.chunk

4.0.0 • Public • Published

Member of the starry suite—modular functions for iterable objects.

npm node

Status

Applies to the whole suite.

Build Status Coverage Status

Usage

function chunk<T = any>(
  iterable: Iterable<T>,
  size: number = 1
  ): Iterable<T[]>

Returns an iterable that yields groups of elements as a group of size size is received from the iterable iterable.

If the iterable ends with an insufficient number of elements required to fill a group, that final group is yielded.

Parameters:

  • iterable: Iterable<T>
  • size: number

Returns: Iterable<T[]>

Package Sidebar

Install

npm i starry.chunk

Weekly Downloads

1

Version

4.0.0

License

MIT

Unpacked Size

8.61 kB

Total Files

9

Last publish

Collaborators

  • seangenabe