effect-io-ai

Package: effect
Module: Chunk

Chunk.take

Takes the first up to n elements from the chunk.

Example (Taking elements from the start)

import { Chunk } from "effect"

const chunk = Chunk.make(1, 2, 3, 4, 5)
const result = Chunk.take(chunk, 3)
console.log(Chunk.toArray(result)) // [1, 2, 3]

Signature

declare const take: { (n: number): <A>(self: Chunk<A>) => Chunk<A>; <A>(self: Chunk<A>, n: number): Chunk<A>; }

Source

Since v2.0.0