News for hackers. Stuff that matters.
Re:Introducing Sugarless - A Functional & Context Oriented w... by mike_ivanov on Wednesday December 21, 2011 @06:20PM (#3379562)
A better approach to it: http://documentcloud.github.com/underscore/#chain

    var stooges = [{name : 'curly', age : 25},
                   {name : 'moe', age : 21},
                   {name : 'larry', age : 23}];
    var youngest = _(stooges).chain()
      .sortBy(function(stooge){ return stooge.age; })
      .map(function(stooge){ 
        return stooge.name + ' is ' + stooge.age; })
      .first()
      .value();

There are no comments on this comment yet.