Skip to content

Instantly share code, notes, and snippets.

Janos Gyerik janosgyerik

Block or report user

Report or block janosgyerik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View partition.js
'use strict'
* Partition the given list into separate groups which may be, at most, the size given.
* @param {Array<T>} list This may be any array-like object that supports indexing and has a length property
* @param {Number} size Any positive integer that is not NaN
* @return {Array<Array<T>>} A set of arrays that are sized based upon the given size. The nested arrays may be
* no larger than the given size, but **may** be smaller; there will be no empty arrays
* @throws {TypeError} If list is falsey (i.e, undefined/null)
* @throws {TypeError} If list does not have a length property
You can’t perform that action at this time.