MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / chunkify

Function chunkify

Hashes/MD5.js:36–42  ·  view source on GitHub ↗

* Separates an array into equal sized chunks * * @param {Array|string} array - array or string to separate into chunks * @param {number} size - number of elements wanted in each chunk * @return {Array} - array of original array split into chunks * * @example * chunkify("this is a test",

(array, size)

Source from the content-addressed store, hash-verified

34 * chunkify("this is a test", 2)
35 */
36function chunkify(array, size) {
37 const chunks = []
38 for (let i = 0; i < array.length; i += size) {
39 chunks.push(array.slice(i, i + size))
40 }
41 return chunks
42}
43
44/**
45 * Rotates the bits to the left

Callers 1

MD5Function · 0.70

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected