Skip to content

Instantly share code, notes, and snippets.

@ogiermaitre
Created January 11, 2018 09:28
Show Gist options
  • Select an option

  • Save ogiermaitre/be1a24bcee62939c647ec83dfcc0845e to your computer and use it in GitHub Desktop.

Select an option

Save ogiermaitre/be1a24bcee62939c647ec83dfcc0845e to your computer and use it in GitHub Desktop.
[keysDeep lodash] #javascript #node #lodash #es6
_.mixin({
keysDeep: (object) =>
_.keys(object).reduce((o, k) =>
[
...o,
...(_.isObject(object[k]) && !_.isArray(object[k])) ?
_.keysDeep(object[k]).map(e => `${k}.${e}`) : [k]],
[])
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment