Skip to content

Commit

Permalink
Merge branch 'master' of github.com:documentcloud/underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed Jan 23, 2012
2 parents 99c17c4 + 9c88b72 commit f6a1b97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions test/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ $(document).ready(function() {
var doubled = _.map([1, 2, 3], function(num){ return num * 2; });
equals(doubled.join(', '), '2, 4, 6', 'doubled numbers');

doubled = _.collect([1, 2, 3], function(num){ return num * 2; });
equals(doubled.join(', '), '2, 4, 6', 'aliased as "collect"');

var tripled = _.map([1, 2, 3], function(num){ return num * this.multiplier; }, {multiplier : 3});
equals(tripled.join(', '), '3, 6, 9', 'tripled numbers with context');

Expand Down
2 changes: 1 addition & 1 deletion underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

// Return the results of applying the iterator to each element.
// Delegates to **ECMAScript 5**'s native `map` if available.
_.map = function(obj, iterator, context) {
_.map = _.collect = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
Expand Down

0 comments on commit f6a1b97

Please sign in to comment.