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

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

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [constrainDataObjects](./repository.constraindataobjects.md)

## constrainDataObjects() function

A utility function which takes an array of model instance data and enforces constraint(s) on it

<b>Signature:</b>

```typescript
export declare function constrainDataObjects<T extends Entity>(originalData: DataObject<T>[], constraint: DataObject<T>): DataObject<T>[];
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  originalData | [DataObject](./repository.dataobject.md)<!-- -->&lt;T&gt;\[\] | the array of model data to apply the constrain(s) to |
|  constraint | [DataObject](./repository.dataobject.md)<!-- -->&lt;T&gt; | the constraint which is to be applied on the data objects |

<b>Returns:</b>

[DataObject](./repository.dataobject.md)<!-- -->&lt;T&gt;\[\]

an array of the modified data with the constraint, otherwise the original instance data array


