-
-
Save leocaseiro/c5280b7cc492da98cbc9c86d1c110fb9 to your computer and use it in GitHub Desktop.
Revisions
-
dreadjr revised this gist
May 27, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,17 @@ _.mixin({ 'orderKeysBy': function (obj, comparator, order) { if (_.isString(comparator) && _.isEmpty(order)) { order = comparator; comparator = null; } var keys = _.orderBy(_.keys(obj), function (key) { return comparator ? comparator(obj[key], key) : key; }, order); var values = _.map(keys, function (key) { return obj[key]; }); return _.zipObject(keys, values); } }); -
dreadjr revised this gist
May 27, 2016 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,9 @@ _.mixin({ 'orderKeysBy': function (obj, comparator, order) { if (_.isString(comparator) && _.isNull(order)) { order = comparator; comparator = null; } var keys = _.orderBy(_.keys(obj), function (key) { return comparator ? comparator(obj[key], key) : key; }, order); -
dreadjr revised this gist
May 27, 2016 . 1 changed file with 10 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,13 @@ _.mixin({ 'orderKeysBy': function (obj, comparator, order) { var keys = _.orderBy(_.keys(obj), function (key) { return comparator ? comparator(obj[key], key) : key; }, order); var values = _.map(keys, function (key) { return obj[key]; }); return _.zipObject(keys, values); } }); -
dreadjr revised this gist
May 27, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ _.mixin({ return comparator ? comparator(obj[key], key) : key; }); return _.zipObject(keys, _.map(keys, function (key) { return obj[key]; })); } -
colingourlay revised this gist
Sep 23, 2014 . 2 changed files with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ var obj = {b: 3, c: 2, a: 1}; _.sortKeysBy(obj); // {a: 1, b: 3, c: 2} _.sortKeysBy(obj, function (value, key) { return value; }); // {a: 1, c: 2, b: 3} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ _.mixin({ 'sortKeysBy': function (obj, comparator) { var keys = _.sortBy(_.keys(obj), function (key) { return comparator ? comparator(obj[key], key) : key; }); return _.object(keys, _.map(keys, function (key) { -
colingourlay created this gist
Sep 22, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ _.mixin({ 'sortKeysBy': function (obj, comparator) { var keys = _.sortBy(_.keys(obj), function (key) { return comparator(obj[key], key); }); return _.object(keys, _.map(keys, function (key) { return obj[key]; })); } });