Skip to content

Instantly share code, notes, and snippets.

@jayphelps
Last active August 29, 2015 14:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jayphelps/b0bc1a9bcad42265d39b to your computer and use it in GitHub Desktop.
Save jayphelps/b0bc1a9bcad42265d39b to your computer and use it in GitHub Desktop.
Resolve property paths
/**
Object.resolve(document, 'body.style')
*/
Object.resolve = function resolve(obj, propPath) {
return [obj]
.concat(propPath.split('.'))
.reduce((prevObj, currKey) => prevObj[currKey]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment