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

Function takeOption

packages/effect/src/TxPriorityQueue.ts:443–450  ·  view source on GitHub ↗
(self: TxPriorityQueue<A>)

Source from the content-addressed store, hash-verified

441 * @since 2.0.0
442 */
443export const takeOption = <A>(self: TxPriorityQueue<A>): Effect.Effect<Option<A>> =>
444 TxRef.modify(self.ref, (chunk) => {
445 const head = C.head(chunk)
446 if (O.isNone(head)) {
447 return [O.none<A>(), chunk]
448 }
449 return [O.some(head.value), C.drop(chunk, 1)]
450 })
451
452/**
453 * Takes up to `n` elements from the queue in priority order.

Callers

nothing calls this directly

Calls 2

someMethod · 0.80
modifyMethod · 0.65

Tested by

no test coverage detected