documentcloud / underscore-contrib

The brass buckles on Underscore's utility belt
MIT License
621 stars 117 forks source link

Add _.pluckPath #161

Open joshuacc opened 10 years ago

joshuacc commented 10 years ago

See https://github.com/jashkenas/underscore/issues/712

This is a natural extension of our existing _.getPath method.

joshuacc commented 10 years ago

@fogus How are you feeling about dependencies between sublibraries these days? The most natural implementation of _.pluckPath would reuse _.getPath internally, but they belong in different sublibraries.

fogus commented 10 years ago

That's a good question that I don't have a good answer for. I do believe it's fine in theory to add cross dependencies, but if it's a single functional dependecy maybe we should avoid it. I don't have a good feel for where the crossover point occurs however.

On Saturday, August 30, 2014, Joshua Clanton notifications@github.com wrote:

@fogus https://github.com/fogus How are you feeling about dependencies between sublibraries these days? The most natural implementation of .pluckPath would reuse .getPath internally, but they belong in different sublibraries.

— Reply to this email directly or view it on GitHub https://github.com/documentcloud/underscore-contrib/issues/161#issuecomment-53957909 .

-- http://blog.fogus.me

-- http://github.com/fogus

joshuacc commented 10 years ago

Okay. For now, I'll implement dependency-free. But I do believe that there would be a lot of advantages in consolidating everything into a single library that can share more internal code.

AlphaGit commented 10 years ago

Would this be solved by #175 ?

joshuacc commented 10 years ago

@AlphaGit No. The pluckPath method would operate on an array and return a new array consisting of the values found at the given path. Basically map + getPath.