Initial commit of 001code-html Scratch frontend project.

Includes scratch-gui, scratch-vm, scratch-blocks, scratch-render, scratch-l10n, and deployment config.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-16 15:37:45 +08:00
commit 6e0a1fbcbb
11350 changed files with 965674 additions and 0 deletions

21
scratch-l10n/lib/batch.js Normal file
View File

@@ -0,0 +1,21 @@
/* eslint-disable valid-jsdoc */
/**
* Maps each value of an array into an async function, and returns an array of the results
* @template In
* @template Out
* @param {In[]} arr - array of values
* @param {number} batchSize - number of calls to `func` to do at one time
* @param {(value: In) => Promise<Out>} func - async function to apply to all items in `arr`. Takes one argument.
* @return {Promise<Out[]>} - results of `func` applied to each item in `arr`
*/
exports.batchMap = async (arr, batchSize, func) => {
const results = [];
for (let i = 0; i < arr.length; i += batchSize) {
const result = await Promise.all(
arr.slice(i, i + batchSize).map(func)
);
results.push(...result);
}
return results;
};