Fix duplicated values when fixed sorting

This commit is contained in:
apanizo 2018-10-24 12:14:48 +02:00
parent 70dd3767b4
commit 20d9ca92f9
1 changed files with 2 additions and 1 deletions

View File

@ -23,7 +23,8 @@ const desc = (a: Object, b: Object, orderBy: string, orderProp: boolean) => {
export const stableSort = (array: any, cmp: any, fixed: boolean) => {
const fixedElems = fixed ? array.filter(elem => elem[FIXED]) : []
const stabilizedThis = array.map((el, index) => [el, index])
const data = fixed ? array.filter(elem => !elem[FIXED]) : array
const stabilizedThis = data.map((el, index) => [el, index])
stabilizedThis.sort((a, b) => {
const order = cmp(a[0], b[0])