MCPcopy
hub / github.com/nukeop/nuclear / prepend

Method prepend

packages/player/src/utils/RingBuffer.ts:34–42  ·  view source on GitHub ↗
(items: T[])

Source from the content-addressed store, hash-verified

32 }
33
34 prepend(items: T[]): void {
35 const current = this.toArray();
36 this.clear();
37 const combined = [...items, ...current];
38 const toKeep = combined.slice(-this.capacity);
39 for (const item of toKeep) {
40 this.push(item);
41 }
42 }
43}

Callers 2

RingBuffer.test.tsFile · 0.80
initLogStreamFunction · 0.80

Calls 3

toArrayMethod · 0.95
clearMethod · 0.95
pushMethod · 0.95

Tested by

no test coverage detected