djyde / djyde/StoreDB

Allow callback finding all data.

Open
#10 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
327
Forks
45
PR merge metrics
No merged PRs in 30d

Description

Hi there,

The current version does not allow set a callback when we use the find function with no parameters.

An enhancement maybe,

``` javascript
find: function (obj, callback) {
if (!obj) {
if(callback){
callback(err, cache);
} else{
return cache;
}
} else {
var result = [];

for (var key in obj) {
for (var i = 0; i < cache.length; i++) {
if (cache[i][key] == obj[key]) {
result.push(cache[i]);
}
}
}
if (callback)
callback(err, result);
else
return result;
}
},
```

What do you think @djyde? By the way, awsome work!!!

Cheers

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.