Fix duplicated values when fixed sorting
This commit is contained in:
parent
70dd3767b4
commit
20d9ca92f9
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue