Name conversion between tables and js objects drives me crazy in Sequelize. Often I have to use quite complex SQL queries, where I have to use 'query' method. The result from query has keys underscored. Does Sequelize provide any helper to convert them to camelCased version ? Right now, I just give an aliases to columns in SQL queries, but it seems tedious. There are also solutions like: https://github.com/domchristie/humps, but still I wonder if there is any better way to do it.
There is an
underscored option on the
sequelize.define options object, but it does not do what the documentation says.
The docs state "Converts all camelCased columns to underscored if true", however, that only appears to be for Sequelize generated fields, such as timestamps and foreign keys.
underscoredAll to true will also set
underscored to true.