return 'undefined' if last elem in path is not present 
in doc, matching javascript object behavior.
Merge pull request #245 from tedsuo/master

return 'undefined' if last elem in path is not present