Skip to content

Commit 847df15

Browse files
committed
1 parent 7abd060 commit 847df15

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/react-bootstrap-table2/src/store/sort.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
import _ from '../utils';
55
import Const from '../const';
66

7+
const collator = new Intl.Collator();
78
function comparator(a, b) {
8-
let result;
99
if (typeof b === 'string') {
10-
result = b.localeCompare(a);
10+
return collator.compare(a, b);
1111
} else {
12-
result = a > b ? -1 : ((a < b) ? 1 : 0);
12+
return a > b ? -1 : ((a < b) ? 1 : 0);
1313
}
14-
return result;
1514
}
1615

1716
export const sort = (data, sortOrder, { dataField, sortFunc, sortValue }) => {

packages/react-bootstrap-table2/src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ function isEmptyObject(obj) {
5656
const hasOwnProperty = Object.prototype.hasOwnProperty;
5757
const keys = Object.keys(obj);
5858

59-
for (let i = 0; i < keys.length; i += 1) {
60-
if (hasOwnProperty.call(obj, keys[i])) return false;
59+
for (let key of keys) {
60+
if (hasOwnProperty.call(obj, key)) return false;
6161
}
6262

6363
return true;

0 commit comments

Comments
 (0)