This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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 |