MCPcopy Create free account
hub / github.com/Faheem-Khan97/javascript-coding-problems-with-theory / chopInputArray

Function chopInputArray

utils/index.ts:28–40  ·  view source on GitHub ↗
(arr: T[], size: number)

Source from the content-addressed store, hash-verified

26}
27
28export function chopInputArray<T>(arr: T[], size: number): Array<T[]> {
29 const res = [];
30 let startIndex = 0;
31 let endIndex = size - 1;
32
33 while (startIndex < arr.length) {
34 const r = arr.slice(startIndex, endIndex + 1);
35 res.push(r);
36 startIndex += size;
37 endIndex += size;
38 }
39 return res;
40}

Callers 1

mapLimitFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected