Deep pluck feature
Can underscore pluck have a deep pluck feature to do this:
_([{o:{a:1}},{o:{a:43}},{o:{a:234}},{o:{a:23}}]).pluck("o.a")
Nope, we don't want to stray into "string programming". Instead, use map, or a more robust syntax like JSONPath.
String programming?
Nested plucking would be highly useful. Why is this feature not implemented and instead developers are forced to reinvent the wheel?
grumble grumble
underscore has a change of being better than lodash.
Just found lodash-deep after I complained here. Had no idea lodash actually implemented some of it. Sweet!
And thanks to Underscore for reinforcing our choice to switch to lodash :)
I made a _.deepPick back then which is less "string programming"
@chevex: lodash-deep is a 3rd party module, because lodash also refused to implement deepPluck. Maybe there's a reason for this.
@dandv Dan please reread the thread you linked to. Lodash has had deep pluck support since v3.7.0.
That ^
Lol
@jdalton That is quite funny because I linked to your comment saying
I still think something that walks namespace string, e.g. a.b.c, has a place just not in Lo-Dash core. It would be great to see a mixin or lib that specializes in this kind of API sugar.
before closing the issue (that's when I stopped reading).
Now I see the link in my post goes a few comments down the thread.
Anyway, I'm happy deep plucking is supported in lodash via _.map(collection, 'a.b.c').
@dandv
Now I see the link in my post goes a few comments down the thread.
Glad that's all cleared up :)
Deep property support is also available in several other methods.