@loopback/docs
Version:
Documentation for LoopBack 4
37 lines (23 loc) • 1.17 kB
Markdown
---
lang: en
title: 'API docs: repository.constraindataobjects'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.repository.constraindataobjects.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/repository](./repository.md) > [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 | <code>DataObject<T>[]</code> | the array of model data to apply the constrain(s) to |
| constraint | <code>DataObject<T></code> | the constraint which is to be applied on the data objects |
<b>Returns:</b>
`DataObject<T>[]`
an array of the modified data with the constraint, otherwise the original instance data array