Completed dot pathed object tranformation

Here's an implementation of the unfinished/buggy object transformation which should do what was desired.

Running in the console with the example returns the desired output below:

```
{
	"foo":{
		"bar":"bluebar",
		"color":"blue"
	}
} 
```

I also formatted the code to be more readable, I hope you don't mind. The only code which was actually changed is the `dotpath()` function