akveo / akveo/ng2-smart-table

LocalDataSource - add option to find by predicate

Open
#1,081 0 comments 1 reaction 0 assignees View on GitHub
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.