koopjs / koop-provider-google-sheets

Create a Koop provider to bring in data from Google Sheets into Insights for ArcGIS
Other
6 stars 3 forks source link

Issue with column headings with spaces #12

Open slibby opened 6 years ago

slibby commented 6 years ago

If the Google Sheet has column headings with spaces in them, the fields returned in the /FeatureServer/0 request will includes spaces in the field name. This causes issues with Filter requests against the Feature Services.

I can address this by changing https://github.com/koopjs/koop-provider-google-sheets/blob/master/sheets.js#L50 to

      props[propertyNames[i].replace(' ','_')] = prop

But would like someone (a real developer's!) feedback on that approach. I've tested it and it worked for me, maybe there is a more elegant way to do it.

jgravois commented 6 years ago

would like someone (a real developer's!) feedback on that approach

👍

replace(' ','_')] = prop

if the (╯°□°)╯︵ ┻━┻) homage is intentional, extreme bonus points.

hhkaos commented 6 years ago

I would change that for:

props[propertyNames[i].trim().replace(/ /ig, "_")] = prop

This way you will replace all spaces and trim the string too ^_^

slibby commented 6 years ago

thanks @hhkaos, much better!