tri des cols, on transforme en lowercase
This commit is contained in:
parent
4e21e5a168
commit
73edf728a7
2 changed files with 5 additions and 1 deletions
|
@ -26,7 +26,9 @@ const orderBy = (arr, props, orders) =>
|
|||
arr.sort((a, b) =>
|
||||
props.reduce((acc, prop, i) => {
|
||||
if (acc === 0) {
|
||||
const [p1, p2] = orders && orders[i] === 'desc' ? [b[prop], a[prop]] : [a[prop], b[prop]];
|
||||
let [p1, p2] = orders && orders[i] === 'desc' ? [b[prop], a[prop]] : [a[prop], b[prop]];
|
||||
p1 = typeof p1 === 'string' ? p1.toLowerCase() : p1;
|
||||
p2 = typeof p2 === 'string' ? p2.toLowerCase() : p2;
|
||||
acc = p1 > p2 ? 1 : p1 < p2 ? -1 : 0;
|
||||
}
|
||||
return acc;
|
||||
|
|
|
@ -43,6 +43,8 @@ var orderBy = function orderBy(arr, props, orders) {
|
|||
p1 = _ref2[0],
|
||||
p2 = _ref2[1];
|
||||
|
||||
p1 = typeof p1 === 'string' ? p1.toLowerCase() : p1;
|
||||
p2 = typeof p2 === 'string' ? p2.toLowerCase() : p2;
|
||||
acc = p1 > p2 ? 1 : p1 < p2 ? -1 : 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue