Skip to content

Commit

Permalink
[Collection] Modify sortBy() to use map() method
Browse files Browse the repository at this point in the history
  • Loading branch information
townxelliot committed Apr 10, 2014
1 parent ba3426e commit 6d7c373
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions TUL.js
Expand Up @@ -150,10 +150,8 @@
// sort the collection in place;
// fn takes a, b arguments for each pair of items in the collection
sortBy: function (fn) {
var withKeys = [];

TUL.forEach(this.items, function (v, k) {
withKeys.push({key: k, value: v});
var withKeys = TUL.map(this.items, function (v, k) {
return {key: k, value: v};
});

var sortedArray = withKeys.sort(function (a, b) {
Expand Down

0 comments on commit 6d7c373

Please sign in to comment.