Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 10x 5300x 10x 10x 10x 10x 10x 32x 32x 4x 28x 28x 10x 63x 10x 32x 10x 63x 10x 12x 10x 22x 10x 4098x 10x 4125x 10x 4099x | import type { CustomEventNormalized, Variable, } from "shared/lib/entities/entitiesTypes"; const arrayNStrings = (n: number) => Array.from(Array(n).keys()).map((n) => String(n)); export const allVariables = arrayNStrings(512); export const localVariables = arrayNStrings(6); export const tempVariables = arrayNStrings(2); export const customEventVariables = arrayNStrings(10); type VariablesLookup = { [name: string]: Variable | undefined }; /****************************************************************************** * Custom Event Variables */ export const customEventVariableName = ( variable: string, customEvent: CustomEventNormalized ): string => { const customEventVariable = customEvent.variables[`V${variable}`]; if (customEventVariable) { return customEventVariable.name; } const letter = String.fromCharCode( "A".charCodeAt(0) + parseInt(variable, 10) ); return `Variable ${letter}`; }; export const customEventVariableCode = (variable: string) => { return `V${variable}`; }; /****************************************************************************** * Local Variables */ export const localVariableName = ( variable: string, entityId: string, variablesLookup: VariablesLookup ) => { return ( variablesLookup[`${entityId}__L${variable}`]?.name || `Local ${variable}` ); }; export const localVariableCode = (variable: string) => { return `L${variable}`; }; /****************************************************************************** * Temp Variables */ export const tempVariableName = (variable: string) => { return `Temp ${variable}`; }; export const tempVariableCode = (variable: string) => { return `T${variable}`; }; /****************************************************************************** * Global Variables */ export const globalVariableName = ( variable: string, variablesLookup: VariablesLookup ) => { return variablesLookup[variable]?.name || globalVariableDefaultName(variable); }; export const globalVariableDefaultName = (variable: string) => { return `Variable ${variable}`; }; export const globalVariableCode = (variable: string) => { return variable.padStart(2, "0"); }; |