Skip to content

Instantly share code, notes, and snippets.

@JohnMarkT
Created September 18, 2018 15:29
Show Gist options
  • Save JohnMarkT/142817d2abfa43da802d5dc79db905da to your computer and use it in GitHub Desktop.
Save JohnMarkT/142817d2abfa43da802d5dc79db905da to your computer and use it in GitHub Desktop.
get deeply nested property -- returns undefined if not found
function getDeep(obj, key) {
return key.split('.').reduce((o, x) => {
return (o || {})[x];
}, obj);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment