Code review on #12

See commit messages for detailed informations on what changed.

Needless to say tests are still running properly (thanks for providing tests!). :smile:
I aggree, I was searching for a simple way to have an `indexOf` matching `\n` or `\r` (whichever comes the first). It can be changed with two indexOf, check `!= -1`, then `Math.min` if you prefer.