MCPcopy Create free account
hub / github.com/Effect-TS/effect / take

Method take

packages/effect/src/PubSub.ts:2774–2787  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2772 this.slideIndex = this.buffer.index
2773 }
2774 take(): A | undefined {
2775 if (this.remaining === 0) {
2776 return undefined
2777 }
2778 this.sync()
2779 const value = this.values[this.index]
2780 this.values[this.index] = AbsentValue as unknown as A
2781 this.index = (this.index + 1) % this.values.length
2782 this.remaining--
2783 if (this.remaining === 0) {
2784 this.close()
2785 }
2786 return value as A
2787 }
2788 takeN(n: number): Array<A> {
2789 const len = Math.min(n, this.remaining)
2790 const items = new Array(len)

Callers 1

takeNMethod · 0.95

Calls 2

syncMethod · 0.95
closeMethod · 0.95

Tested by

no test coverage detected