Ox.sort: handle thousand separators
This commit is contained in:
parent
fc8368cc9f
commit
36bb42e7bd
1 changed files with 7 additions and 4 deletions
|
@ -625,10 +625,11 @@ Ox.range = function() {
|
||||||
return false; // break
|
return false; // break
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// pad numbers
|
// remove thousand separators and pad numbers
|
||||||
sortValue = sortValue.replace(/\d+/g, function(match) {
|
sortValue = sortValue.replace(/(\d),(?=(\d{3}))/g, '$1')
|
||||||
return Ox.pad(match, 'left', 64, '0');
|
.replace(/\d+/g, function(match) {
|
||||||
});
|
return Ox.pad(match, 'left', 64, '0');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return sortValue;
|
return sortValue;
|
||||||
}, {key: function(args) {
|
}, {key: function(args) {
|
||||||
|
@ -647,6 +648,8 @@ Ox.range = function() {
|
||||||
[{id: 1, name: '8 Women'}, {id: 0, name: '80 Days'}]
|
[{id: 1, name: '8 Women'}, {id: 0, name: '80 Days'}]
|
||||||
> Ox.sort(['In 80 Days Around the World', 'In 9 Minutes Around the World'])
|
> Ox.sort(['In 80 Days Around the World', 'In 9 Minutes Around the World'])
|
||||||
['In 9 Minutes Around the World', 'In 80 Days Around the World']
|
['In 9 Minutes Around the World', 'In 80 Days Around the World']
|
||||||
|
> Ox.sort(['80 Days', '20,000 Leagues'])
|
||||||
|
['80 Days', '20,000 Leagues']
|
||||||
> Ox.sort(['Man', 'A Plan', 'The Canal'])
|
> Ox.sort(['Man', 'A Plan', 'The Canal'])
|
||||||
['The Canal', 'Man', 'A Plan']
|
['The Canal', 'Man', 'A Plan']
|
||||||
> Ox.sort(['The 9', 'The 10', 'An A', 'A "B"'])
|
> Ox.sort(['The 9', 'The 10', 'An A', 'A "B"'])
|
||||||
|
|
Loading…
Reference in a new issue