Map with sorted values.
npm install sorted-value-map
const { SortedValueMap } = require('sorted-value-map')
const map = new SortedValueMap((a, b) => {
if (a < b) return -1
else if (a > b) return 1
else return 0
})
map.insert("key-a", 8)
map.insert("key-b", 2)
for (const a of map.values()) {
console.log(a) // 2, 8
}
SortedValueMap uses the same API as the official Map.
MIT. Copyright (c) Alex