effect-io-ai

Package: effect
Module: Chunk

Chunk.join

Joins the elements together with “sep” in the middle.

Example (Joining chunks into a string)

import { Chunk } from "effect"

const chunk = Chunk.make("apple", "banana", "cherry")
const result = Chunk.join(chunk, ", ")
console.log(result) // "apple, banana, cherry"

// With different separator
const withPipe = Chunk.join(chunk, " | ")
console.log(withPipe) // "apple | banana | cherry"

// Empty chunk
const empty = Chunk.empty<string>()
console.log(Chunk.join(empty, ", ")) // ""

// Single element
const single = Chunk.make("hello")
console.log(Chunk.join(single, ", ")) // "hello"

Signature

declare const join: { (sep: string): (self: Chunk<string>) => string; (self: Chunk<string>, sep: string): string; }

Source

Since v2.0.0