-
Notifications
You must be signed in to change notification settings - Fork 0
array/plucks #1
Comments
The naming is a little confusing since it actually returns a function. Usually pluck methods perform the map as well. |
This is a tough call because it reads so nicely. Agreed though. We should probably add a suffix such as
|
I like the pluralizing "plucks". It still reads well. Another option to be a "to" prefix so it reads like "map to". var names = customers.map(toProp('name'));
var salary = customer.filter(toProp('fullTime')); |
Let's see how well plural and "to" play out for other utils. |
Multiple args for deep plucks? // gets customer.addresses.home.state
var states = customers.map(plucks('addresses', 'home', 'state')).filter(unique()); |
👍 I was thinking that plucks might return an object with multiple keys based on multiple args, but that should probably be a different util. |
I was thinking dot notation like var publicInfo = customers.map(plucks('name', 'email', ['address', 'state'])); Might get a little nasty though. A separate method might be justified. |
Agreed about dot-notation. I thought about arrays too, but yeah, getting nasty. |
Added |
Pluck functionality
The text was updated successfully, but these errors were encountered: