Sorts an array of objects in ascending order by the given property name, assuming it is a number.
const data = [ { size: 10, colour: `red` }, { size: 20, colour: `blue` }, { size: 5, colour: `pink` }];const sorted = Arrays.sortByNumericProperty(data, `size`);Yields items ascending order:[ { size: 5, colour: `pink` }, { size: 10, colour: `red` }, { size: 20, colour: `blue` } ] Copy
const data = [ { size: 10, colour: `red` }, { size: 20, colour: `blue` }, { size: 5, colour: `pink` }];const sorted = Arrays.sortByNumericProperty(data, `size`);Yields items ascending order:[ { size: 5, colour: `pink` }, { size: 10, colour: `red` }, { size: 20, colour: `blue` } ]
Sorts an array of objects in ascending order by the given property name, assuming it is a number.