Skip to content
Shapemetry

@huukhanhnguyen/model / document/assets

document/assets

indexByName()

indexByName<T>(records): Map<string, T>

Index resolved by-name records (materials / layers / styles) for lookup. FIRST match wins, in lane order — the one by-name resolution law. A duplicate LITERAL name is a validation error, but a name produced by an expression is unchecked and can still collide at evaluate time; every consumer must then agree on which record it means, and Material.get's .find already decided that answer. (A plain new Map(list.map(...)) quietly says LAST — that disagreement is what this replaces.)

Type Parameters

T

T extends { name: string; }

Parameters

records

readonly T[] | undefined

Returns

Map<string, T>

Last updated: 📖 1 min readEdit on GitHub