For clarity, I'd leave the "var atNewLine = (index === 0);" line in.  It's useful to give that expression a name.