Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
options.format = descriptor.format || 'csv'
options.encoding = descriptor.encoding
const dialect = descriptor.dialect
if (dialect) {
if (dialect.header === false || config.DEFAULT_DIALECT.header === false) {
const fields = (descriptor.schema || {}).fields || []
options.headers = fields.length ? fields.map(field => field.name) : null
}
helpers.validateDialect(dialect)
for (const key of DIALECT_KEYS) {
if (dialect[key]) options[key.toLowerCase()] = dialect[key]
}
}
const schemaDescriptor = this._currentDescriptor.schema
const schema = schemaDescriptor ? new Schema(schemaDescriptor) : null
this._table = new Table(this.source, {schema, ...options})
}
return this._table
}