Merge pull request #1560 from braddunbar/aliases

Ensure that Collection proxies underscore aliases.
This commit is contained in:
Jeremy Ashkenas
2012-08-20 06:50:55 -07:00
2 changed files with 11 additions and 10 deletions

View File

@@ -864,11 +864,12 @@
});
// Underscore methods that we want to implement on the Collection.
var methods = ['forEach', 'each', 'map', 'reduce', 'reduceRight', 'find',
'detect', 'filter', 'select', 'reject', 'every', 'all', 'some', 'any',
'include', 'contains', 'invoke', 'max', 'min', 'sortBy', 'sortedIndex',
'toArray', 'size', 'first', 'initial', 'rest', 'last', 'without', 'indexOf',
'shuffle', 'lastIndexOf', 'isEmpty', 'groupBy'];
var methods = ['forEach', 'each', 'map', 'collect', 'reduce', 'foldl',
'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select',
'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke',
'max', 'min', 'sortBy', 'sortedIndex', 'toArray', 'size', 'first', 'head',
'take', 'initial', 'rest', 'tail', 'last', 'without', 'indexOf', 'shuffle',
'lastIndexOf', 'isEmpty', 'groupBy'];
// Mix in each Underscore method as a proxy to `Collection#models`.
_.each(methods, function(method) {

View File

@@ -1436,7 +1436,7 @@ alert(JSON.stringify(collection));
<ul class="small">
<li><a href="http://underscorejs.org/#each">forEach (each)</a></li>
<li><a href="http://underscorejs.org/#map">map</a></li>
<li><a href="http://underscorejs.org/#map">map (collect)</a></li>
<li><a href="http://underscorejs.org/#reduce">reduce (foldl, inject)</a></li>
<li><a href="http://underscorejs.org/#reduceRight">reduceRight (foldr)</a></li>
<li><a href="http://underscorejs.org/#find">find (detect)</a></li>
@@ -1444,7 +1444,7 @@ alert(JSON.stringify(collection));
<li><a href="http://underscorejs.org/#reject">reject</a></li>
<li><a href="http://underscorejs.org/#all">every (all)</a></li>
<li><a href="http://underscorejs.org/#any">some (any)</a></li>
<li><a href="http://underscorejs.org/#include">include</a></li>
<li><a href="http://underscorejs.org/#include">include (contains)</a></li>
<li><a href="http://underscorejs.org/#invoke">invoke</a></li>
<li><a href="http://underscorejs.org/#max">max</a></li>
<li><a href="http://underscorejs.org/#min">min</a></li>
@@ -1454,9 +1454,9 @@ alert(JSON.stringify(collection));
<li><a href="http://underscorejs.org/#shuffle">shuffle</a></li>
<li><a href="http://underscorejs.org/#toArray">toArray</a></li>
<li><a href="http://underscorejs.org/#size">size</a></li>
<li><a href="http://underscorejs.org/#first">first</a></li>
<li><a href="http://underscorejs.org/#first">first (head, take)</a></li>
<li><a href="http://underscorejs.org/#initial">initial</a></li>
<li><a href="http://underscorejs.org/#rest">rest</a></li>
<li><a href="http://underscorejs.org/#rest">rest (tail)</a></li>
<li><a href="http://underscorejs.org/#last">last</a></li>
<li><a href="http://underscorejs.org/#without">without</a></li>
<li><a href="http://underscorejs.org/#indexOf">indexOf</a></li>
@@ -2340,7 +2340,7 @@ var Bookmark = Backbone.View.extend({
<a href="http://github.com/sstephenson/eco">Eco</a> are all fine alternatives.
Because <a href="http://underscorejs.org/">Underscore.js</a> is already on the page,
<a href="http://underscorejs.org/#template">_.template</a>
is available, and is an excellent choice if you prefer simple
is available, and is an excellent choice if you prefer simple
interpolated-JavaScript style templates.
</p>