UNPKG

caminho

Version:

Tool for creating efficient data pipelines in a JavaScript environment

28 lines 1.14 kB
var PendingDataControlInMemory = (function () { function PendingDataControlInMemory() { this.size = 0; this.buckets = new Map(); } PendingDataControlInMemory.prototype.increment = function (bucketId, value) { var _a; if (value === void 0) { value = 1; } this.size += value; var current = (_a = this.buckets.get(bucketId)) !== null && _a !== void 0 ? _a : 0; this.buckets.set(bucketId, current + value); }; PendingDataControlInMemory.prototype.decrement = function (bucketId, value) { if (value === void 0) { value = 1; } this.size -= value; var current = this.buckets.get(bucketId); this.buckets.set(bucketId, current - value); }; PendingDataControlInMemory.prototype.destroyBucket = function (bucketId) { var _a; var inBucket = (_a = this.buckets.get(bucketId)) !== null && _a !== void 0 ? _a : 0; this.size -= inBucket; this.buckets.delete(bucketId); }; return PendingDataControlInMemory; }()); export { PendingDataControlInMemory }; //# sourceMappingURL=PendingDataControl.js.map