---
lang: en
title: 'API docs: repository.reduceasarray'
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.reduceasarray.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [reduceAsArray](./repository.reduceasarray.md)

## reduceAsArray() function

Returns an array of instances. For HasMany relation usage.

<b>Signature:</b>

```typescript
export declare function reduceAsArray<T>(acc: T[] | undefined, it: T): T[];
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  acc | T\[\] \| undefined |  |
|  it | T |  |

<b>Returns:</b>

T\[\]


