use isNaN and parseInt for fasterness

Using `isNaN(parseInt(digit, 10))` is faster than `unless /^\d+$/.test(digit)` (see [jsperf](http://jsperf.com/test-if-number-2)), and I think reads a little cleaner, since a lot of the surrounding code is using parseInt anyways. The unary operator (`+digit`), which is essentially a shorthand for `Number(digit)`, looks even cleaner but is slightly slower.