Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function discernParser (filePath, opts_) {
if (opts_ && opts_.delimiter === true) {
return dsvFormat(filePath).parse
}
var format = discernFormat(filePath)
var parser = parsers[format]
// If we don't have a parser for this format, return as text
if (typeof parser === 'undefined') {
parser = parsers['txt']
}
return parser
}
export default function (str, parserOptions) {
parserOptions = parserOptions || {}
return dsvFormat('|').parse(str, parserOptions.map)
}
export default function (file, writeOptions) {
writeOptions = writeOptions || {}
file = formattingPreflight(file, 'psv')
try {
return dsvFormat('|').format(file, writeOptions.columns)
} catch (err) {
parseError('psv')
}
}