collectBlocks() refactor

@latentflip: I tried my hand at a `collectBlocks()` refactor. I tried to keep the style consistent w/ the rest of the project, but feel free to adjust if anything looks unnatural.

I wasn't sure if it was worth it to include underscore just to get `_.last()` so I defined a `last()` function... a lot of times I'll just use the `arr[arr.length - 1` idiom, but since it was there a couple times, I figured it might be cleaner to use `last()`...

I renamed `child` to `node` -- usually I would prefer the more specific `child`, but I wanted to consolidate and handle `block` and `child` together (pushing to `currentNodeList`), so I figured the more generic `node` was more appropriate...

Feel free to modify anything (including the things mentioned above) as suits your taste.

Thanks for writing domthing & contributing it to the open-source community!