UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

37 lines (24 loc) 1.43 kB
--- lang: en title: 'API docs: repository.flattentargetsofonetomanyrelation' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/repository permalink: /doc/en/lb4/apidocs.repository.flattentargetsofonetomanyrelation.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [flattenTargetsOfOneToManyRelation](./repository.flattentargetsofonetomanyrelation.md) ## flattenTargetsOfOneToManyRelation() function Returns an array of instances. The order of arrays is based on as a result of one to many relation. The order of arrays is based on the order of sourceIds <b>Signature:</b> ```typescript export declare function flattenTargetsOfOneToManyRelation<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](./repository.stringkeyof.md)<!-- -->&lt;Target&gt; | name of the target key | <b>Returns:</b> (Target\[\] \| undefined)\[\]