shannonmoeller-archive / mtil

Supporting vanilla JavaScript functionality since 2014. **Unmaintained**
1 stars 0 forks source link

array/unique #4

Open shannonmoeller opened 10 years ago

shannonmoeller commented 10 years ago

Self explanatory.

nickstark commented 10 years ago

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

var departments = customers.map(plucks('department')).filter(unique());
shannonmoeller commented 10 years ago

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

nickstark commented 10 years ago

Arguments:

depts.filter(unique({
    deep: true,
    comparator: alphabeticEqualityFunc
}))
shannonmoeller commented 10 years ago

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())));