As you can see above I have to arrays. The above one is from an easy search fetch and the bottom one from a normal meteor collection fetch.
I am trying to get the intersection of both with a custom _.intersectionObjects like this
_.intersectionObjects = function(array) {
var slice = Array.prototype.slice; // added this line as a utility
var rest = slice.call(arguments, 1);
return _.filter(_.uniq(array), function(item) {
return _.every(rest, function(other) {
//return _.indexOf(other, item) >= 0;
return _.any(other, function(element) { return _.isEqual(element, item); });
});
});
};
The function runs fine width to arrays returned from a collection.find().fetch().
I am not quite sure if this is the problem but if both arrays contain documents instead of objects the function runs fine.
Is it possible to make easy-search's search().fetch() return an array of documents like the one in the bottom of the picture above.
As you can see above I have to arrays. The above one is from an easy search fetch and the bottom one from a normal meteor collection fetch. I am trying to get the intersection of both with a custom _.intersectionObjects like this
The function runs fine width to arrays returned from a collection.find().fetch().
I am not quite sure if this is the problem but if both arrays contain documents instead of objects the function runs fine.
Is it possible to make easy-search's search().fetch() return an array of documents like the one in the bottom of the picture above.
Thank you in advance!