Skip to content

prepend

ts
function String.prepend(
    target: string,
    source: Iterable<string>,
): string

Prepends string or strings from source iterable to the beginning of target string.

Example

ts
import { String } from "@monstermann/string";

String.prepend("world", "hello "); // "hello world"
String.prepend("world", ["hello", " "]); // "hello world"
ts
import { String } from "@monstermann/string";

pipe("world", String.prepend("hello ")); // "hello world"
pipe("world", String.prepend(["hello", " "])); // "hello world"