mirror of
https://github.com/LukeHagar/sveltesociety.dev.git
synced 2025-12-06 04:21:38 +00:00
* feat: Add updateGitlab.js * feat: Add updateGithub.js * Remove stars action * Remove @actions/core * Add injectors * Fix matching repo URLs * Format * Simplify injectData * Add shared chunk.js file
16 lines
390 B
JavaScript
16 lines
390 B
JavaScript
/**
|
|
* Divide an array into multiple smaller array
|
|
* @param {Array} input
|
|
* @param {number} size
|
|
* @return {Array<Array>}
|
|
*/
|
|
export function chunk(input, size) {
|
|
size = size < 1 ? 10 : size;
|
|
const pages = Math.ceil(input.length / size);
|
|
const final = [];
|
|
for (let index = 0; index < pages; index++) {
|
|
final.push(input.slice(index * size, (index + 1) * size));
|
|
}
|
|
return final;
|
|
}
|