brandonmp / gatsby-source-google-sheets

A GatsbyJS plugin that pulls nodes from rows in a Google Sheet.
90 stars 32 forks source link

Camel Case not working on normal strings "User email" #7

Open tbaustin opened 6 years ago

tbaustin commented 6 years ago

I think you stated this in the readme, maybe instead of lodash you could use the camelcase npm module https://www.npmjs.com/package/camelcase. I think it works on normal strings just fine and many others. It is actually what I use for my gatsby plugins to camelcase data before putting it into graphql.

const camelCase = require('camelcase');
type: camelCase(`googleSheet ${worksheetTitle} row`),

That should make strings like "User email" into userEmail.

brandonmp commented 6 years ago

Thanks, i'll take a look!

Lodash should work fine on simple space delineated strings (see repl example here).

I can't remember exactly, but I think part of the problem is how google sheets handles spaces in column names. e.g., it might just strip them out with no indication as to where the spaces were.

Whatever the root cause, though, it's definitely a problem, so I'll keep this open to track it

tbaustin commented 6 years ago

Awesome let me know if there is anything I can do to help!