• Prefixes each line in the given string with the given prefix.

    Parameters

    • line: string
    • prefix: string

    Returns string

    const text = `Line 1
    Line 2
    Line 3`;
    const prefixed = prefixLines(text, '> ');
    console.log(prefixed);

    This will output:

    > Line 1
    > Line 2
    > Line 3