added "collect" alias for "map"

This commit is contained in:
Peter Jihoon Kim
2012-01-13 20:09:50 +08:00
parent dd09162b8c
commit 978255b778
2 changed files with 4 additions and 1 deletions

View File

@@ -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);