Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 337 Bytes

README.md

File metadata and controls

14 lines (9 loc) · 337 Bytes

SortByAttr

Sorts an array by a single comparable attribute. Additional options for sorting descending. Returns the sorted array.

Example

const lowestFirst = myArr.sortByAttr(x => x.score);

const lowestFirst = myArr.sortByAttr(x => x.score, "ASC");

const highestFirst = myArr.sortByAttr(x => x.score, "DESC");