mirror of
https://github.com/LukeHagar/sveltesociety.dev.git
synced 2025-12-06 12:47:44 +00:00
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
This commit is contained in:
15
scripts/chunk.js
Normal file
15
scripts/chunk.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
Reference in New Issue
Block a user