1
var AllOne = function () {8
* @param {function} handler11
AllOne.prototype.sort = function (map, handler) {12
return new Map([...map].sort(handler));19
AllOne.prototype.inc = function (key) {20
this.map.set(key, this.map.get(key) + 1 || 1);28
AllOne.prototype.dec = function (key) {29
this.map.get(key) == 130
? this.map.delete(key)31
: this.map.set(key, this.map.get(key) - 1);38
AllOne.prototype.getMaxKey = function () {39
if (this.pre != "max") {40
this.map = this.sort(this.map, (a, b) => b[1] - a[1]);43
return this.map.keys().next().value || "";49
AllOne.prototype.getMinKey = function () {50
if (this.pre != "min") {51
this.map = this.sort(this.map, (a, b) => a[1] - b[1]);54
return this.map.keys().next().value || "";