adding OO-style object wrapping (thanks macournoyer) -- now you can to _(array).each();

This commit is contained in:
Jeremy Ashkenas
2009-11-07 12:39:59 -05:00
parent 51298c78ca
commit 4f0afda61c
6 changed files with 50 additions and 9 deletions

View File

@@ -11,6 +11,12 @@
return timesTwo;
});
JSLitmus.test('_(list).each()', function() {
var timesTwo = [];
_(numbers).each(function(num){ timesTwo.push(num * 2); });
return timesTwo;
});
JSLitmus.test('_.map()', function() {
return _.map(objects, function(obj){ return obj.num; });
});