-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
It would be awesome to have the ability to specify and pass parameters/properties to a keyword
filter.
Example keyword definition for a rating filter:
keywords: {
rating: {
queries: [
'{{count}} stars',
'rated {{count}}'
],
filter: (collection, {count}) => {
return collection.filter(item => item.rating >= parseInt(count, 10))
}
}
}
Questions:
- Should type conversions be handled by the user?
- We could have it test for a parsed Number, and if
true
, pass as a number (feels too prescriptive).const numCount = parseInt(count) return numCount ? numCount : count
- Users could specify types in the keyword definition. Would be useful for validation before filtering collection.
{ queries: ..., filter: ..., props: { count: Number } }
- We could have it test for a parsed Number, and if