Function: normalizeKey()
normalizeKey(
key):undefined| {type:string;id:string;name:string; }
Defined in: utils.ts:25
Normalizes a reference key by extracting type, id, and name information.
This function parses reference keys in the format ref(type:id:name) and extracts
the individual components. It's used internally for processing asset references.
Parameters
key
string
The reference key to normalize, either in ref(type:id:name) format or a plain string
Returns
undefined | { type: string; id: string; name: string; }
An object containing the parsed type, id, and normalized name, or undefined if the key format is invalid
Examples
const result = normalizeKey('ref(font:123:MyFont.ttf)');
// Returns: { type: 'font', id: '123', name: 'MyFont' }
const result = normalizeKey('plain-string');
// Returns: undefined (invalid format)