soiz1's picture
Upload 811 files
30c32c8 verified
raw
history blame
588 Bytes
/**
* @fileoverview
* General ScratchX-related utilities used in multiple places.
* Changing these functions may break projects.
*/
/**
* @param {string} scratchXName
* @returns {string}
*/
const generateExtensionId = scratchXName => {
const sanitizedName = scratchXName.replace(/[^a-z0-9]/gi, '').toLowerCase();
return `sbx${sanitizedName}`;
};
/**
* @param {number} i 0-indexed index of argument in list
* @returns {string} Scratch 3 argument name
*/
const argumentIndexToId = i => i.toString();
module.exports = {
generateExtensionId,
argumentIndexToId
};