UNPKG

@cloud-copilot/iam-lens

Version:

Visibility in IAM in and across AWS accounts

43 lines 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RingQueue = void 0; class RingQueue { buffer; head = 0; tail = 0; size; capacity; constructor(capacity) { this.capacity = capacity; this.buffer = new Array(capacity); this.size = 0; } enqueue(item) { if (this.size >= this.capacity) return false; this.buffer[this.tail] = item; this.tail = (this.tail + 1) % this.capacity; this.size++; return true; } dequeue() { if (this.size === 0) return undefined; const item = this.buffer[this.head]; this.buffer[this.head] = undefined; this.head = (this.head + 1) % this.capacity; this.size--; return item; } isEmpty() { return this.size === 0; } length() { return this.size; } isFull() { return this.size === this.capacity; } } exports.RingQueue = RingQueue; //# sourceMappingURL=RingQueue.js.map