web-csv-toolbox - v0.14.0
    Preparing search index...

    Type Alias JoinCSVFields<Chars, Delimiter, Quotation, Nl>

    JoinCSVFields: Chars extends readonly [infer F, ...(infer R)]
        ? F extends string
            ? R extends string[]
                ? `${F extends `${string}${Nl
                | Delimiter
                | Quotation}${string}`
                    ? `${Quotation}${F}${Quotation}`
                    : F}${R extends [] ? "" : Delimiter}${JoinCSVFields<
                    R,
                    Delimiter,
                    Quotation,
                >}`
                : string
            : string
        : ""

    Join CSV field array into a CSV-formatted string with proper escaping.

    Type Parameters

    This type handles CSV-specific formatting:

    • Quotes fields containing delimiters, quotations, or newlines
    • Joins fields with the specified delimiter
    const header = ["name", "age", "city", "zip"];

    type _ = JoinCSVFields<typeof header>
    // `name,age,city,zip`
    const header = ["name", "a\nge", "city", "zip"];

    type _ = JoinCSVFields<typeof header, "@", "$">
    // `name@$a\nge$@city@zip`