metasoarous / semantic-csv

Higher level tools for working with CSV data and files
http://metasoarous.github.io/semantic-csv
Eclipse Public License 1.0
255 stars 22 forks source link

Add `:transform-header` option to mappify #26

Closed metasoarous closed 7 years ago

metasoarous commented 9 years ago

This would just be a function applied to each one of the headers column names to get a new column name. Returning nil should leave unaltered, so that a map could be used easily for transforming a subset of the header names. There is some question here though about how this would play with the :keywordify option.

metasoarous commented 9 years ago

Some further thoughts on this:

We should be able to leave the current :keywordify option by having that option take precedence if :transform-header is not specified, and let :transform-header take precedence otherwise. This keeps us from breaking the API.

Also, we should provide a few helper functions with some particular conventions. Maybe, idiomatic-column-name which lower cases, then replaces spaces and underscores with dashes. Some others could just replace spaces with dashes, remove spaces, etc.

See comments by dunnowins here: https://www.reddit.com/r/Clojure/comments/35b6dl/semanticcsv_highlevel_csv_processing_tools_for/

sbelak commented 8 years ago

If you are not very pro-batteries included, https://github.com/qerub/camel-snake-kebab includes just about every conversion under the sun.

metasoarous commented 8 years ago

That's nice! Thanks for the suggestion. I'd like to middle ground on batteries, so in addition to some nice sane options, referring folks to csk is a great idea.

metasoarous commented 7 years ago

This was closed by #33