Updated more REST tests
Small cleanups and added require(share).scriptsDir
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
merge