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

localstorage filters wrong document list

parent 13656a2a
...@@ -67,6 +67,24 @@ ...@@ -67,6 +67,24 @@
var ram = {}, memorystorage, localstorage, hasOwnProperty = var ram = {}, memorystorage, localstorage, hasOwnProperty =
Function.prototype.call.bind(Object.prototype.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 * Checks if an object has no enumerable keys
* *
...@@ -456,8 +474,8 @@ ...@@ -456,8 +474,8 @@
} }
jIO.QueryFactory.create(options.query || "", jIO.QueryFactory.create(options.query || "",
this._key_schema). this._key_schema).
exec(document_list, options).then(function () { exec(document_list, options).then(function (document_list) {
document_list = document_list.map(function (value) { filterMap(document_list, function (value) {
var o = { var o = {
"id": value._id "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