Page Contents

Home > @loopback/repository > flattenTargetsOfOneToOneRelation

flattenTargetsOfOneToOneRelation() function

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

Signature:

export declare function flattenTargetsOfOneToOneRelation<Target extends Entity>(sourceIds: unknown[], targetEntities: Target[], targetKey: StringKeyOf<Target>): (Target | undefined)[];

Parameters

Parameter Type Description
sourceIds unknown[] One value or array of values of the target key
targetEntities Target[] target entities that satisfy targetKey’s value (ids).
targetKey StringKeyOf<Target> name of the target key

Returns:

(Target | undefined)[]