Skip to content
This repository has been archived by the owner on Aug 23, 2019. It is now read-only.

array/unique #4

Open
shannonmoeller opened this issue May 2, 2014 · 4 comments
Open

array/unique #4

shannonmoeller opened this issue May 2, 2014 · 4 comments

Comments

@shannonmoeller
Copy link
Member

Self explanatory.

@nickstark
Copy link

So, this would defer to native too, right? So it actually returns a function.

var departments = customers.map(plucks('department')).filter(unique());

@shannonmoeller
Copy link
Member Author

Exactly. The returned function would have access to a private array of values to check against.

@nickstark
Copy link

Arguments:

  • Bool, deep object equality
  • Function, comparator (could be shared with sorting functions)
depts.filter(unique({
    deep: true,
    comparator: alphabeticEqualityFunc
}))

@shannonmoeller
Copy link
Member Author

I think we should keep this simple and just do a === check, unless a specific comparator is provided as an argument.

depts.filter(unique(deep()));
depts.filter(unique(alphabeticEquality()));
depts.filter(unique(deep(alphabeticEquality())));

@shannonmoeller shannonmoeller added this to the 1.0.0 milestone Jul 8, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants