@ -285,6 +285,9 @@ License: MIT
/** whether to prevent outputting cells that can be parsed as formulae by spreadsheet software (Excel and LibreOffice) */
/** whether to prevent outputting cells that can be parsed as formulae by spreadsheet software (Excel and LibreOffice) */
var _escapeFormulae = false ;
var _escapeFormulae = false ;
/** whether to surround every datum that has spaces in the start or in the end with quotes */
var _quoteDataWithSpaces = true ;
unpackConfig ( ) ;
unpackConfig ( ) ;
var quoteCharRegex = new RegExp ( escapeRegExp ( _quoteChar ) , 'g' ) ;
var quoteCharRegex = new RegExp ( escapeRegExp ( _quoteChar ) , 'g' ) ;
@ -367,6 +370,9 @@ License: MIT
if ( typeof _config . escapeFormulae === 'boolean' )
if ( typeof _config . escapeFormulae === 'boolean' )
_escapeFormulae = _config . escapeFormulae ;
_escapeFormulae = _config . escapeFormulae ;
if ( typeof _config . quoteDataWithSpaces === 'boolean' )
_quoteDataWithSpaces = _config . quoteDataWithSpaces ;
}
}
@ -464,8 +470,8 @@ License: MIT
|| ( Array . isArray ( _quotes ) && _quotes [ col ] )
|| ( Array . isArray ( _quotes ) && _quotes [ col ] )
|| hasAny ( escapedQuoteStr , Papa . BAD _DELIMITERS )
|| hasAny ( escapedQuoteStr , Papa . BAD _DELIMITERS )
|| escapedQuoteStr . indexOf ( _delimiter ) > - 1
|| escapedQuoteStr . indexOf ( _delimiter ) > - 1
|| escapedQuoteStr . charAt ( 0 ) === ' '
|| ( _quoteDataWithSpaces && escapedQuoteStr . charAt ( 0 ) === ' ' )
|| escapedQuoteStr . charAt ( escapedQuoteStr . length - 1 ) === ' ' ;
|| ( _quoteDataWithSpaces && escapedQuoteStr . charAt ( escapedQuoteStr . length - 1 ) === ' ' ) ;
return needsQuotes ? _quoteChar + escapedQuoteStr + _quoteChar : escapedQuoteStr ;
return needsQuotes ? _quoteChar + escapedQuoteStr + _quoteChar : escapedQuoteStr ;
}
}