Newline character converter for JavaScript