Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/react-bootstrap-table2/src/store/sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
import _ from '../utils';
import Const from '../const';

const collator = new Intl.Collator();
function comparator(a, b) {
let result;
if (typeof b === 'string') {
result = b.localeCompare(a);
return collator.compare(a, b);
} else {
result = a > b ? -1 : ((a < b) ? 1 : 0);
return a > b ? -1 : ((a < b) ? 1 : 0);
}
return result;
}

export const sort = (data, sortOrder, { dataField, sortFunc, sortValue }) => {
Expand Down
12 changes: 5 additions & 7 deletions packages/react-bootstrap-table2/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
import _ from 'underscore';

function splitNested(str) {
return [str]
.join('.')
.replace(/\[/g, '.')
.replace(/\]/g, '')
.split('.');
return str
.replace(']', '')
.split(/\[\./);
}

function contains(list, value) {
Expand Down Expand Up @@ -58,8 +56,8 @@ function isEmptyObject(obj) {
const hasOwnProperty = Object.prototype.hasOwnProperty;
const keys = Object.keys(obj);

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

return true;
Expand Down