Don't split string just for counting "\n"

No need to split a text into lines just to count the number of '\n'.
This involves allocation twice amount of memory for a simple
character count. The bigger the file, the more memory you allocate
w/o any need.

http://jsperf.com/string-split-vs-for-loop-count/4

I'm curious though if you just simply don't care about memory consumption. Feel free to drop my pull request if so.