MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / enqueue

Method enqueue

cli/src/utils/arrays.ts:52–75  ·  view source on GitHub ↗
(...items: T[])

Source from the content-addressed store, hash-verified

50 }
51
52 enqueue(...items: T[]) {
53 if (this._items.length < this._length + items.length) {
54 const newItems = [
55 ...repeated(undefined as T, this._length),
56 ...items,
57 ...repeated(undefined as T, this._length),
58 ]
59 for (let i = 0; i < this._length; i++) {
60 newItems[i] = this.at(i)!
61 }
62
63 this._items = newItems
64 this._head = 0
65 this._length += items.length
66 return
67 }
68
69 let index = (this._head + this._length) % this._items.length
70 for (const item of items) {
71 this._items[index] = item
72 index = (index + 1) % this._items.length
73 }
74 this._length += items.length
75 }
76
77 dequeue(): T | undefined {
78 if (this._length === 0) {

Callers 15

startMethod · 0.80
transformMethod · 0.80
flushMethod · 0.80
startMethod · 0.80
transformMethod · 0.80
flushMethod · 0.80
tickMethod · 0.80
arrays.test.tsFile · 0.80
emitFunction · 0.80
processEventFunction · 0.80
startFunction · 0.80
startFunction · 0.80

Calls 2

atMethod · 0.95
repeatedFunction · 0.85

Tested by 2

startFunction · 0.64
startFunction · 0.64