Skip to content

orderBy can take a Function as its first argument #2591

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

Merged
merged 1 commit into from
Mar 31, 2016

Conversation

posva
Copy link
Member

@posva posva commented Mar 30, 2016

Hello,

This feature was asked in #2518. The point of this generic filter is to support any kind of sorting by using a custom comparator. Tell me your thoughts on the feature and the code 😄

PS: I did the PR instead of the issue because it took little to no time to do it and I didn't have internet when I coded it 😛

@yyx990803
Copy link
Member

Forgot to comment in the feature request issue, but I think this should just be part of orderBy. The first argument can either be a string or a function, this is how filterBy works currently.

@posva
Copy link
Member Author

posva commented Mar 30, 2016

Ok, so instead of giving a String or an Array of string you can also give your own Function.
So the sortKeys becomes {String|Array<String>|Function} instead of just {String|Arrary<String>}. Makes sense to me. I didn't see that filterBy already worked that way

@posva posva force-pushed the feature/sort-filter branch from 6f4414f to 6cf4b60 Compare March 30, 2016 21:23
@posva posva changed the title Add abstract sort filter orderBy can take a Function as its first argument Mar 30, 2016
@posva posva force-pushed the feature/sort-filter branch from 6cf4b60 to 138495b Compare March 30, 2016 21:27
@posva
Copy link
Member Author

posva commented Mar 30, 2016

Let me review this a last time tomorrow in the morning (I want to be fresh 😄 )
I'll ping you when the PR is ready for review
I'll also update the doc

@posva posva force-pushed the feature/sort-filter branch from 138495b to 5545515 Compare March 31, 2016 12:14
@posva posva force-pushed the feature/sort-filter branch from 5545515 to b139f35 Compare March 31, 2016 12:15
@posva
Copy link
Member Author

posva commented Mar 31, 2016

ping @yyx990803

@yyx990803 yyx990803 merged commit 74e594b into vuejs:dev Mar 31, 2016
@posva posva deleted the feature/sort-filter branch March 31, 2016 19:33
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.

2 participants