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

Function appendAllUnsafe

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

Source from the content-addressed store, hash-verified

386 * @since 4.0.0
387 */
388export const appendAllUnsafe = <A>(self: MutableList<A>, messages: ReadonlyArray<A>, mutable = false): number => {
389 if (messages.length === 0) {
390 return 0
391 }
392 const chunk: MutableList.Bucket<A> = {
393 array: messages as Array<A>,
394 mutable,
395 offset: 0,
396 next: undefined
397 }
398 if (self.head) {
399 self.tail = self.tail!.next = chunk
400 } else {
401 self.head = self.tail = chunk
402 }
403 self.length += messages.length
404 return messages.length
405}
406
407/**
408 * Removes all elements from the MutableList, resetting it to an empty state.

Callers 1

appendAllFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected