Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Ensure that Collection proxies underscore aliases. #1560

Merged
merged 1 commit into from

2 participants

@braddunbar
Collaborator

Added the following aliases:

  • collect
  • foldl
  • inject
  • foldr
  • head
  • take
  • tail
@braddunbar braddunbar Ensure that Collection proxies underscore aliases.
Added the following aliases:

* collect
* foldl
* inject
* foldr
* head
* take
* tail
952fb88
@jashkenas jashkenas merged commit 6782ba2 into jashkenas:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 18, 2012
  1. @braddunbar

    Ensure that Collection proxies underscore aliases.

    braddunbar authored
    Added the following aliases:
    
    * collect
    * foldl
    * inject
    * foldr
    * head
    * take
    * tail
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 10 deletions.
  1. +6 −5 backbone.js
  2. +5 −5 index.html
View
11 backbone.js
@@ -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
10 index.html
@@ -1436,7 +1436,7 @@ <h2 id="Collection">Backbone.Collection</h2>
<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 @@ <h2 id="Collection">Backbone.Collection</h2>
<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 @@ <h2 id="Collection">Backbone.Collection</h2>
<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 @@ <h2 id="View">Backbone.View</h2>
<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>
Something went wrong with that request. Please try again.