LocalDataSource - add option to find by predicate
Đang mở
- Ngôn ngữ chính
- TypeScript
- Star
- 1.6k
- Fork
- 867
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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'));
}
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.