Files
sveltesociety.dev/scripts/chunk.js
Lachlan Collins ea37aa2395 feat: Separate github and gitlab scripts (#526)
* 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
2023-12-18 17:44:20 +11:00

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;
}