src/table.js
function createCsvDelimiterDetector(csvParser) {
  const detector = PassThrough()
  const sniffer = new CSVSniffer()
  let done = false

  detector.on('data', (chunk) => {
    if (!done) {
      const result = sniffer.sniff(chunk.toString())
      csvParser.options.delimiter = result.delimiter
      done = true
    }
  })

  return detector
}
function createCsvDelimiterDetector(csvParser) {
  const detector = PassThrough()
  const sniffer = new CSVSniffer()
  let done = false

  detector.on('data', (chunk) => {
    if (!done) {
      const result = sniffer.sniff(chunk.toString())
      csvParser.options.delimiter = result.delimiter
      done = true
    }
  })

  return detector
}
function createCsvDelimiterDetector ( csvParser ) { const detector = PassThrough ( ) const sniffer = new CSVSniffer ( ) let done = false detector . on ( 'data' , ( chunk ) => { if ( ! done ) { const result = sniffer . sniff ( chunk . toString ( ) ) csvParser . options . delimiter = result . delimiter done = true } } ) return detector }
Detects the CSV delimiter, updating the received `csvParser` options.

It will use the first chunk to detect the CSV delimiter, and update it on
`csvParser.options.delimiter`. After this is finished, no further processing
will be done.

@param {module:csv/parse} csvParser - The csv.parse() instance
@return {module:stream/PassThrough}
Detects the CSV delimiter updating the received csvParser options .