Yomguithereal/baobab-react

Filtering an array via cursor

soulprovidr opened this issue · 3 comments

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

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.

Thanks a lot, I appreciate your input. I'll use a monkey for this. 👍