datastore: refactor transaction & datastore.

Hello again!

I rearranged a few things, hopefully for the better. I'll leave comments. :)
Looks like the shortening of the paths to jshint will work, but not mocha. Mocha requires the wildcards (apparently). I split out the `jshint` portion to a `lint` script, leaving `test` just for Mocha.