Skip to content

Commit

Permalink
fix sort error
Browse files Browse the repository at this point in the history
  • Loading branch information
patorjk committed Aug 28, 2019
1 parent d1914e4 commit 73d6889
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ function getCollatorComparator() {

function sortCompare(order) {
return (a, b) => {
if (a.data === null) a.data = '';
if (b.data === null) b.data = '';
var aData = (a.data === null || typeof a.data === 'undefined') ? '' : a.data;
var bData = (b.data === null || typeof b.data === 'undefined') ? '' : b.data;
return (
(typeof a.data.localeCompare === 'function' ? a.data.localeCompare(b.data) : a.data - b.data) *
(typeof aData.localeCompare === 'function' ? aData.localeCompare(bData) : aData - bData) *
(order === 'asc' ? 1 : -1)
);
};
Expand Down

0 comments on commit 73d6889

Please sign in to comment.