Skip to content

Instantly share code, notes, and snippets.

View gavboulton's full-sized avatar

Gavin Boulton gavboulton

  • London / St Albans
View GitHub Profile
@gavboulton
gavboulton / flattenObject.js
Last active July 26, 2017 19:02
Flatten object keys
const flattenObject = obj => {
if (typeof obj !== 'object') {
return obj;
}
function flattenKeys(value, key, storedKey) {
const newKey = storedKey ? `${storedKey}.${key}` : key;
if (typeof value === 'object') {
const firstKey = Object.keys(value)[0];

Keybase proof

I hereby claim:

  • I am gavboulton on github.
  • I am gavboulton (https://keybase.io/gavboulton) on keybase.
  • I have a public key ASC8LP7WQuQ2aF-pT_VNRnvl6UhcC5wQT9F3l3nhOc-d9wo

To claim this, I am signing this object: