some linting and refactoring, several loop optimizations

Several cases of loop unrolling/switch instead of several if-else done. Far more efficient to use switch instead of several numerical conditionals. Should provide a boost to performance with the parsing.

Did plenty of other smaller optimizations and bug fixes such as `null === null` is false, whereas `isNull(null)` is true. Introduced a few helper functions.

Also did a lot of readability improvements/linting.

There are a few cases of subbing switch-case statements for if-else segments (it greatly simplified a conditional in a somewhat hackish way).