Function join

Joins the array of lines back into a string using the platform specific EOL.

  • Parameters

    • lines: string[]
    • __namedParameters: Partial<Options> = {}

    Returns string

    lines.join(["1", "2", "3"]); // "1\n2\n3" or on windows "1\r\n2\r\n3"

    // add line numbers
    lines.join(["import { } from '.'", "console.log('test')"], { lineNumbers: true });
    // 1 import { } from '.'
    // 2 console.log('test')

    // add a custom prefix
    lines.join(["import { } from '.'", "console.log('test')"], { prefix: () => " + " });
    // + import { } from '.'
    // + console.log('test')