MCPcopy Create free account
hub / github.com/effect-app/libs / appendAllUnsafe

Function appendAllUnsafe

repos/effect/packages/effect/src/MutableList.ts:519–536  ·  view source on GitHub ↗
(self: MutableList<A>, messages: ReadonlyArray<A>, mutable = false)

Source from the content-addressed store, hash-verified

517 *
518 * **Example** (Taking one element)
519 *
520 * ```ts import.meta.vitest
521 * import { MutableList } from "effect"
522 *
523 * const list = MutableList.make<string>()
524 * MutableList.appendAll(list, ["first", "second", "third"])
525 *
526 * MutableList.take(list) // => "first"
527 * MutableList.toArray(list) // => ["second", "third"]
528 * list.length // => 2
529 * ```
530 *
531 * @category mutations
532 * @since 4.0.0
533 */
534export const take = <A>(self: MutableList<A>): Empty | A => {
535 if (!self.head) return Empty
536 const message = self.head.array[self.head.offset]
537 if (self.head.mutable) self.head.array[self.head.offset] = undefined as any
538 self.head.offset++
539 self.length--

Callers 1

appendAllFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…