Skip to content

Commit

Permalink
fix: don't reorder attrs with the same name (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvasilkov authored Apr 28, 2020
1 parent c5fce51 commit f9706c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions lib/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ function sortAttrs(attrs) {
return attrs.sort(function(a, b) {
if (a.name < b.name) {
return -1;
} else if (a.name > b.name) {
return 1;
} else if (a.value < b.value) {
return -1;
} else if (a.value > b.value) {
}
if (a.name > b.name) {
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ describe('\'utils\'', function() {
],
output = [
{ name: 'a', value: 'z' },
{ name: 'b', value: 'a' },
{ name: 'b', value: 'b' },
{ name: 'b', value: 'a' },
{ name: 'b', value: 'c' },
{ name: 'c', value: 'c' },
{ name: 'z', value: 'a' },
Expand Down

0 comments on commit f9706c8

Please sign in to comment.