I have a model like this:
model =
from: "a@b.com"
id: 1
to: [c@d.com]
and I have a collection containing these kind of models. The collection needs to filter by from
. I know _.where
an underscore.js
function. I am using it like this:
fromIds = _.pluck _.where(msgs, from : login), 'msgId'
and need to filter by 'to' as well:
toIds = _.pluck _.where(msgs, to : login), 'msgId'
it does not work, because to
is an array. How can I filter by to
? I would be grateful if someone helped me out !