src/lib/csv.js
function toCsvValue(theValue, sDelimiter) {
    const t = typeof (theValue);
    let output,
        stringDelimiter
    ;

    if (typeof (sDelimiter) === "undefined" || sDelimiter === null)
        stringDelimiter = '"';
    else
        stringDelimiter = sDelimiter;

    if (t === "undefined" || t === null)
        output = '';
    else if (t === 'string')
        output = sDelimiter + theValue + sDelimiter;
    else
        output = String(theValue);

    return output;
}
function toCsvValue(theValue, sDelimiter) {
    const t = typeof (theValue);
    let output,
        stringDelimiter
    ;

    if (typeof (sDelimiter) === "undefined" || sDelimiter === null)
        stringDelimiter = '"';
    else
        stringDelimiter = sDelimiter;

    if (t === "undefined" || t === null)
        output = '';
    else if (t === 'string')
        output = sDelimiter + theValue + sDelimiter;
    else
        output = String(theValue);

    return output;
}
function toCsvValue ( theValue , sDelimiter ) { const t = typeof ( theValue ) ; let output , stringDelimiter ; if ( typeof ( sDelimiter ) === "undefined" || sDelimiter === null ) stringDelimiter = '"' ; else stringDelimiter = sDelimiter ; if ( t === "undefined" || t === null ) output = '' ; else if ( t === 'string' ) output = sDelimiter + theValue + sDelimiter ; else output = String ( theValue ) ; return output ; }
Converts a value to a string appropriate for entry into a CSV table.  E.g., a string value will be surrounded by quotes.
@param {string|number|object} theValue
@param {string} sDelimiter The string delimiter.  Defaults to a double quote (") if omitted.
Converts a value to a string appropriate for entry into a CSV table . E . g . a string value will be surrounded by quotes .