[Pkg-javascript-commits] [backbone] 04/34: brief aside about sort versus sortBy

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:58:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.1.2
in repository backbone.

commit 0ac41263a084ef87122e63e55e597a842584b098
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Thu Oct 14 11:10:38 2010 -0400

    brief aside about sort versus sortBy
---
 index.html | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/index.html b/index.html
index 5085f68..0e71dc9 100644
--- a/index.html
+++ b/index.html
@@ -942,13 +942,21 @@ chapters.add(new Chapter({page: 1, title: "The Beginning"}));
 alert(chapters.pluck('title'));
 </pre>
 
+    <p>
+      <i>
+        Brief aside: This comparator function is different than JavaScript's regular
+        "sort", which must return </i><tt>0</tt>, <tt>1</tt>, or <tt>-1</tt>,<i>
+        and is more similar to a </i><tt>sortBy</tt><i> — a much nicer API.
+      </i>
+    </p>
+
     <p id="Collection-sort">
       <b class="header">sort</b><code>collection.sort([options])</code>
       <br />
       Force a collection to re-sort itself. You don't need to call this under
       normal circumstances, as a collection with a <a href="#Collection-comparator">comparator</a> function
-      will maintain itself in proper sort order at all times. Triggers the
-      collection's <tt>"refresh"</tt> event, unless silenced by passing
+      will maintain itself in proper sort order at all times. Calling <b>sort</b> 
+      triggers the collection's <tt>"refresh"</tt> event, unless silenced by passing
       <tt>{silent: true}</tt>
     </p>
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list