Use my style in getMatching

pull/2/head
Louis Chatriot 9 years ago
parent 3c5cdf9b7e
commit f916e69717
  1. 11
      lib/indexes.js

@ -236,14 +236,12 @@ Index.prototype.revertUpdate = function (oldDoc, newDoc) {
* @return {Array of documents} * @return {Array of documents}
*/ */
Index.prototype.getMatching = function (value) { Index.prototype.getMatching = function (value) {
var _res, res var self = this;
, self = this;
if (!util.isArray(value)) { if (!util.isArray(value)) {
res = self.tree.search(value); return self.tree.search(value);
} else { } else {
_res = {}; var _res = {}, res = [];
res = [];
value.forEach(function (v) { value.forEach(function (v) {
self.getMatching(v).forEach(function (doc) { self.getMatching(v).forEach(function (doc) {
@ -254,8 +252,9 @@ Index.prototype.getMatching = function (value) {
Object.keys(_res).forEach(function (_id) { Object.keys(_res).forEach(function (_id) {
res.push(_res[_id]); res.push(_res[_id]);
}); });
}
return res; return res;
}
}; };

Loading…
Cancel
Save