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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

extract uniqBy as generic method and reuse internally #16567

Merged
merged 1 commit into from Apr 22, 2018

Conversation

bekzod
Copy link
Contributor

@bekzod bekzod commented Apr 22, 2018

@mmun is this worth doing ? 馃槈

@bekzod bekzod force-pushed the uniq-by branch 3 times, most recently from 7a77e71 to c37812c Compare April 22, 2018 13:56

let ret = A();
let seen = new Set();
let getter = arguments.length === 1 ? item => item : get;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do something like

const identityFunction = item => item;
export function uniqBy(array, key = identityFunction) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright

Copy link
Member

@mmun mmun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to do.

@bekzod
Copy link
Contributor Author

bekzod commented Apr 22, 2018

green

@rwjblue rwjblue merged commit f2d0d75 into emberjs:master Apr 22, 2018
@rwjblue
Copy link
Member

rwjblue commented Apr 22, 2018

Awesome, thank you!

@bekzod bekzod deleted the uniq-by branch April 22, 2018 16:56
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.

None yet

3 participants