Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(filters): add more operator types to collection svc filter #66

Merged
merged 3 commits into from
May 20, 2018

Conversation

jmzagorski
Copy link
Collaborator

The default operator 'EQ' was switched to filter for the value instead of excluding it. Also, an explicit check for undefined in the collectionFilterBy.value was added in case the value is actual false, 0, blank or null.

New operator type filters:

  1. in: supports collectionFilterBy.property as a nested array, and if the collectionFilterBy.value exists in the nested array, the parent item will NOT be filtered. For example: collection: [{ foo: ['bar'] }, { foo: ['foo'] }], collectionFilterBy.property: 'foo', collectionFilterBy.value: 'bar' will return the first item in the collection only
  2. notIn: oppostie of in
  3. contains: assumes the collectionFilterBy.value is an array and will check if any of those values exists in the collectionFilterBy.property. For example: collection: [{ foo: 'bar' }, { foo: 'foo' }], collectionFilterBy.property: 'foo', collectionFilterBy.value: [ 'bar', 'foo' ] will return both items

closes #63
BREAKING CHANGE: Reversing the 'EQ' filter logic. This was done now because the filter feature was new and it follows the javascript filter logic (since equal will filter values equal to the value provided)

jmzagorski and others added 3 commits May 19, 2018 17:54
The default operator 'EQ' was switched to filter for the value instead of excluding it. Also, an explicit check for undefined in the `collectionFilterBy.value` was added in case the value is actual false, 0, blank or null.

New operator type filters:
`in`: supports `collectionFilterBy.property` as a nested array, and if the `collectionFilterBy.value` exists in the nested array, the parent item will NOT be filtered. For example: `collection: [{ foo: ['bar'] }, { foo: ['foo'] }]`, `collectionFilterBy.property: 'foo'`, `collectionFilterBy.value: 'bar'` will return the first item in the collection only
`notIn`: oppostie of `in`
`contains`: assumes the `collectionFilterBy.value` is an array and will check if any of those values exists in the `collectionFilterBy.property`. For example: `collection: [{ foo: 'bar' }, { foo: 'foo' }]`, `collectionFilterBy.property: 'foo'`, `collectionFilterBy.value: [ 'bar', 'foo' ]` will return both items

closes #63
BREAKING CHANGE: Reversing the 'EQ' filter logic. This was done now because the filter feature was new and it follows the javascript `filter` logic (since equal will filter values equal to the value provided)
@ghiscoding ghiscoding merged commit 4359e67 into master May 20, 2018
@jmzagorski jmzagorski deleted the feature/more_filter_operators branch May 21, 2018 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question] collectionFilterBy documentation
2 participants