Skip to content

Commit

Permalink
Fixes esamattis#326; don't lowercase the two strings
Browse files Browse the repository at this point in the history
  • Loading branch information
megawac authored and Christoph Hermann committed Dec 7, 2014
1 parent 70ba9a5 commit 8c4aebc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/underscore.string.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@
if (!str2) return 1;

var cmpRegex = /(\.\d+)|(\d+)|(\D+)/g,
tokens1 = String(str1).toLowerCase().match(cmpRegex),
tokens2 = String(str2).toLowerCase().match(cmpRegex),
tokens1 = String(str1).match(cmpRegex),
tokens2 = String(str2).match(cmpRegex),
count = Math.min(tokens1.length, tokens2.length);

for(var i = 0; i < count; i++) {
Expand Down
5 changes: 4 additions & 1 deletion test/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ $(document).ready(function() {
['15ac', '15ab32'],
['16', '15ab'],
['15a123', '15a122'],
['15ab16', '15ab']
['15ab16', '15ab'],
['abc', 'Abc'],
['abc', 'aBc'],
['aBc', 'Abc']
], function(vals) {
var a = vals[0], b = vals[1];
equal(_.naturalCmp(a, b), 1, '\'' + a + '\' >= \'' + b + '\'');
Expand Down

0 comments on commit 8c4aebc

Please sign in to comment.