Page Contents

Home > @loopback/repository > flattenMapByKeys

flattenMapByKeys() function

Returns an array of instances from the target map. The order of arrays is based on the order of sourceIds

Signature:

export declare function flattenMapByKeys<T>(sourceIds: unknown[], targetMap: Map<unknown, T>): (T | undefined)[];

Parameters

Parameter Type Description
sourceIds unknown[] One value or array of values (of the target key)
targetMap Map<unknown, T> a map that matches sourceIds with instances

Returns:

(T | undefined)[]