MCPcopy Create free account
hub / github.com/RealDevSquad/website-backend / chunks

Function chunks

utils/array.js:9–19  ·  view source on GitHub ↗

* Creates an array of elements split into groups the length of size. If array can't be split evenly, the final chunk will be the remaining elements. * description credit: https://lodash.com/docs/4.17.15#chunk * source code inspiron: https://youmightnotneed.com/lodash#chunk * @param {array}: array

(array, size = 1)

Source from the content-addressed store, hash-verified

7 * @return {array}: array of arrays of elements split into groups the length of size.
8 */
9function chunks(array, size = 1) {
10 if (!Array.isArray(array) || size < 1) {
11 return [];
12 }
13 const temp = [...array];
14 const result = [];
15 while (temp.length) {
16 result.push(temp.splice(0, size));
17 }
18 return result;
19}
20
21/**
22 * Checks if two arrays have any common items

Callers 8

updateTaskStatusFunction · 0.85
assignBadgesFunction · 0.85
removeBadgesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected