Returns a array of entries from a map, sorted by value.
const m = new Map();m.set(`4491`, { name: `Bob` });m.set(`2319`, { name: `Alice` });// Compare by nameconst comparer = (a, b) => defaultComparer(a.name, b.name);// Get sorted valuesconst sorted = Maps.sortByValue(m, comparer); Copy
const m = new Map();m.set(`4491`, { name: `Bob` });m.set(`2319`, { name: `Alice` });// Compare by nameconst comparer = (a, b) => defaultComparer(a.name, b.name);// Get sorted valuesconst sorted = Maps.sortByValue(m, comparer);
sortByValue takes a comparison function that should return -1, 0 or 1 to indicate order of a to b. If not provided, Util.defaultComparer is used.
sortByValue
a
b
Optional
Returns a array of entries from a map, sorted by value.
sortByValue
takes a comparison function that should return -1, 0 or 1 to indicate order ofa
tob
. If not provided, Util.defaultComparer is used.