File size: 588 Bytes
30c32c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
 * @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
};