Skip to content

Instantly share code, notes, and snippets.

@DejanBelic
Created March 29, 2019 08:50
Show Gist options
  • Save DejanBelic/100f91fd357eb3a1d9dba9d8d5aba1f9 to your computer and use it in GitHub Desktop.
Save DejanBelic/100f91fd357eb3a1d9dba9d8d5aba1f9 to your computer and use it in GitHub Desktop.
Chaining filters - when having multiple filters to apply
const f1 = h => h.title.toLowerCase().includes(title.toLowerCase());
const f2 = d => d.field_category.toLowerCase().includes(category.toLowerCase());
const f3 = e => e.uid.toLowerCase().includes(author.toLowerCase());
const filtered = nodes.filter(f1).filter(f2).filter(f3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment