Commit 6857cecb authored by Tristan Cavelier's avatar Tristan Cavelier

localstorage filters wrong document list

parent 13656a2a
......@@ -67,6 +67,24 @@
var ram = {}, memorystorage, localstorage, hasOwnProperty =
Function.prototype.call.bind(Object.prototype.hasOwnProperty);
/**
* filterMap(array, callback) : array
*
* Acts like `Array.prototype.map` but does not produces a new array, it
* modifies the original array instead.
*
* @param {Array} array The array to modify
* @param {Function} callback Called in each element being parsed
* @return {Array} The modified array
*/
function filterMap(array, callback) {
var i;
for (i = 0; i < array.length; i += 1) {
array[i] = callback(array[i], i, array);
}
return array;
}
/**
* Checks if an object has no enumerable keys
*
......@@ -456,8 +474,8 @@
}
jIO.QueryFactory.create(options.query || "",
this._key_schema).
exec(document_list, options).then(function () {
document_list = document_list.map(function (value) {
exec(document_list, options).then(function (document_list) {
filterMap(document_list, function (value) {
var o = {
"id": value._id
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment