UNPKG

@mgiamberardino/rate-limiter

Version:
18 lines 473 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class MemoryStore { constructor() { this.map = new Map(); } resetAll() { this.map = new Map(); } increment(key) { const oldValue = this.map.get(key) || new Number(0); const newValue = +oldValue + 1; this.map.set(key, newValue); return newValue; } } exports.MemoryStore = MemoryStore; //# sourceMappingURL=memory.store.js.map