Skip to content

Commit

Permalink
Merge pull request #7 from formap/fix/3-order-users-ignore-casing
Browse files Browse the repository at this point in the history
Case insensitive username ordering
  • Loading branch information
dasilvacontin committed Sep 5, 2015
2 parents af0227a + 24b1897 commit 67c7093
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/gh-sauce.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ module.exports.dress = function (text, config) {
var sortedIssues = _.keys(issues).sort(function (a, b) {
return a - b
})
var sortedUsernames = _.keys(users).sort()
var sortedUsernames = _.keys(users).sort(function (a, b) {
a = a.toLowerCase()
b = b.toLowerCase()
return a < b ? -1 : a > b ? 1 : 0
})

dressed += '\n\n'

Expand Down
5 changes: 3 additions & 2 deletions test/gh-sauce.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ describe('gh-sauce', function () {
})

it('should list usernames alphabetically', function () {
sauce.dress('fix undefined lookup by @phillipj and @dasilvacontin')
sauce.dress('fix undefined lookup by @phillipj, @Formap and @dasilvacontin')
.should.equal([
'fix undefined lookup by [@phillipj] and [@dasilvacontin]',
'fix undefined lookup by [@phillipj], [@Formap] and [@dasilvacontin]',
'',
'[@dasilvacontin]: https://github.com/dasilvacontin',
'[@Formap]: https://github.com/Formap',
'[@phillipj]: https://github.com/phillipj',
''
].join('\n'))
Expand Down

0 comments on commit 67c7093

Please sign in to comment.