blockly > Names > getDistinctName
Names.getDistinctName() method
Convert a Blockly entity name to a legal exportable entity name. Ensure that this is a new name not overlapping any previously defined name. Also check against list of reserved words for the current language and ensure name doesn't collide.
Signature:
getDistinctName(name: string, type: NameType | string): string;
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The Blockly entity name (no constraints). |
type | NameType | string | The type of entity in Blockly ('VARIABLE', 'PROCEDURE', 'DEVELOPER_VARIABLE', etc...). |
Returns:
string
An entity name that is legal in the exported language.