Strip unnecessary whitespace when serializing

@jeffomatic, this is a simple regex find-replace to remove unnecessary whitespace from Javascript functions when serializing.

It finds all instances of two or more whitespace characters and replaces them with a single space.

I also updates the tests to test for equality and ignore all whitespace, which is fine for this case. The javascript maintains the same functionality, so there were no updates to the tests that confirm that serializing, then un-serializing the function still works.