Skip to content

Instantly share code, notes, and snippets.

@bjdixon
Created May 17, 2017 10:21
Show Gist options
  • Save bjdixon/251c5ca1832473a68507ee8102b6a235 to your computer and use it in GitHub Desktop.
Save bjdixon/251c5ca1832473a68507ee8102b6a235 to your computer and use it in GitHub Desktop.
Initialise a nested object from an array of keys
const build = path => path.reduceRight((o, i) => Object.assign({}, {[i]: o}), {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment