LocalDataSource - add option to find by predicate
Open
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 867
- PR merge metrics
- No merged PRs in 30d
Description
like:
findBy(predicate:any): Promise;
this can be the code:
```
LocalDataSource.prototype.findBy = function (predicate){
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
const found = this.data.find(predicate);
if (found) {
return Promise.resolve(found);
}
return Promise.reject(new Error('Element was not found in the dataset'));
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.