Skip to content

Instantly share code, notes, and snippets.

@cpv123
Last active December 22, 2019 13:46
Show Gist options
  • Save cpv123/24eb953fa8627368b6eec9f0171bea85 to your computer and use it in GitHub Desktop.
Save cpv123/24eb953fa8627368b6eec9f0171bea85 to your computer and use it in GitHub Desktop.
const getImmutableTodosByCategory = (todos, categoryId) => (
todos.filter(todo => (
todo.get('categories').filter(category => category.get('id') === categoryId).size > 0
)
)
const getTodosByCategory = (todos, categoryId) => (
todos.filter(todo => (
todo.categories.filter(category => category.id === categoryId).length > 0
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment