Filtering an array via cursor
soulprovidr opened this issue · 3 comments
soulprovidr commented
Hi, first of all, thanks a lot for your work on baobab.
I'm wondering if it would be possible to filter an array via a cursor like this:
export default branch({ filteredChats: [ 'chats', { active: true } ], }, ChatList);
Currently, the library returns the first item it encounters that matches the condition, but it would be cool to be able to filter the array based on the condition instead.
Thanks!
Zache commented
Why not use a monkey?
Den tis 13 mars 2018 18:38Shola Anozie <notifications@github.com> skrev:
… Hi, first of all, thanks a lot for your work on baobab.
I'm wondering if it would be possible to filter an array via a cursor like
this:
export default branch({ filteredChats: [ 'chats', { active: true } ], },
ChatList);
Currently, the library returns the first item it encounters that matches
the condition, but it would be cool to be able to filter the array based on
the condition instead.
Thanks!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#129>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ADYLwBdIurvtysu2k4qBT7721oMAMOjpks5teAP-gaJpZM4SpJIH>
.
Yomguithereal commented
Hello @soulprovidr. @Zache is right. The right tool for the job is probably a monkey. The fact is a cursor cannot be ambiguous and point to several parts of the tree at once.
soulprovidr commented
Thanks a lot, I appreciate your input. I'll use a monkey for this. 👍