Skip to content

Commit

Permalink
fix sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Dec 2, 2014
1 parent 8f79239 commit d88f093
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/datastore/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Transaction.prototype.commit = function(callback) {

// Group entities together by action (delete or save).
.sort(function (a, b) {
return a.method === b.method;
return a.method > b.method;
})

// Group arguments together so that we only make one call to each method.
Expand Down

2 comments on commit d88f093

@stephenplusplus
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanseys - this works as well as numbers. For simple cases like this (basically just alphabetizing based on a key), I avoid the cognitive overhead of -1, 0, and 1. I won't fight if you prefer I go the spec route, however.

@ryanseys
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me.

Please sign in to comment.