IT/Javascript

Lodash : _.orderBy를 사용하여 정렬

so_o 2022. 7. 25. 23:15

 

하나의 값을 이용해서 정렬할 때

_.orderBy(that.List, imte => item.value1, ['desc']);

 

하나 이상의 값을 이용해서 정렬할 때

_.orderBy(that.List, [value1, value2], ['desc', 'asc']);
_.orderBy(that.List, [item => item.value1, item => item.value2], ['desc', 'asc']);