pluck.pluck.pluck

22 views
Skip to first unread message

kstubs

unread,
Sep 24, 2012, 9:25:55 PM9/24/12
to prototype-s...@googlegroups.com
I'm guessing the subject line says it all!  Maybe not, so here is what I'd like to simplify:

tweets.pluck('mediaActivityJSON').pluck('entities').pluck('urls') 

So, I have a pretty in depth tweet object going here but what I am interested in is the urls object.  So, is there a better way to get at the urls object as a collection rather than write the plucks like I have above?  

Karl..

Victor

unread,
Sep 25, 2012, 4:32:39 AM9/25/12
to prototype-s...@googlegroups.com
Something like
function getUrls(tweet) {
  return tweet.mediaActivityJSON.entities.urls;
}
tweets.each(getUrls);

kstubs

unread,
Sep 26, 2012, 2:29:17 AM9/26/12
to prototype-s...@googlegroups.com
Pluck just says, for the array, return the given item/property of the array for every item in the array.  So really, the idea of pluck.pluck.pluck isn't really going to happen.  I retract my question.  Something like Victor is demonstrating is about what I need to do anyhow.

Karl..
Reply all
Reply to author
Forward
0 new messages