Files
discord-decomp/_bundle/LRUCache_12935.js
T
2026-11-01 12:12:55 +02:00

43 lines
947 B
JavaScript

// Metro module 12935 (f12936).
import * as _classCallCheck from "./_classCallCheck";
import * as __createClass from "./_createClass";
let env8925 = {};
const LRUCache = function LRUCache() {
"use strict";
_classCallCheck(this, LRUCache);
this.max = 1000;
this.map = new Map();
};
module.exports = __createClass(LRUCache, [{
key: "get",
value: function get(a0) {
"use strict";
const r6 = this.map.get(a0);
let r7 = void 0;
if (r6 !== void 0) {
this.map.delete(a0);
this.map.set(a0, r6);
r7 = r6;
}
return r7;
}
}, {
key: "delete",
value: function _delete(a0) {
"use strict";
return this.map.delete(a0);
}
}, {
key: "set",
value: function set(a0, a1) {
"use strict";
if (!this.delete(a0) && a1 !== void 0) {
if (this.map.size >= this.max) {
this.delete(this.map.keys().next().value);
}
this.map.set(a0, a1);
}
return this;
}
}]);