Skip to content

Conversation

@glenselle
Copy link

It's not uncommon for a CSV file to have strange or badly formatted column names. This PR adds a new transform function option (mapped to each column name) so column names can be overridden as needed. The default simply returns the existing value so nothing changes.

Usage might be something like this:

let parser = csv({
  columnTransform: function(name) {
    switch (name) {
      case 'some Weird Name':
        return 'new_name'
      default:
        return name
    }
  },
  columns: true
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant