newMapForObjectWithIdentity()
Alpha API. Initial API, highly likely to change outside SemVer. Don’t build on it in production. See API maturity.
Creates ObjRefMap for any object of any type granted that it contains ref property with ObjRef.
The map will be setup so that it extracts id and uri from the ref - thus ensuring that objects that are both uri and identifier refs are indexed properly.
Storing objects whose ref is of both types then allows lookup of those objects externally using either id or uri.
export declare function newMapForObjectWithIdentity<T extends {
identifier: Identifier;
uri: string;
ref: ObjRef;
}>(items: T[], type?: ObjectType, strictTypeCheck?: boolean): ObjRefMap<T>;
Parameters
Parameter | Type | Description |
|---|---|---|
items | T[] | items to insert |
type | (Optional) type of objects, may be undefined | |
strictTypeCheck | boolean | (Optional) whether to do strict type checking when getting by identifierRef |
Returns
ObjRefMap<T>