Closed jedwards1211 closed 9 years ago
Hi @jedwards1211,
This change looks great. Thank you for taking the time to fix this issue!
No problem! I may try to fix some others in the future, depending on if I have time. I adapted the code into a synchronous line reader for my own use...would you be interested in incorporating that into this project?
Sure, it would be great to have that as an option as long as the current functionality is preserved as well.
Right, it would be a separate thing
This change makes the default separator
/\r\n?|\n/
, so that it automatically handles windows, mac, or unix files properly. It still supports string separators as well. If the regexp match is at the very end of the string, it will try to read more so in case there is a longer match.I added tests for windows, mac, and unix files, and also a test where the buffer boundary falls in the middle of an
\r\n
(it should still parse as a single line break with the default settings).This also fixes https://github.com/nickewing/line-reader/issues/24 by adding this check to the beginning of
getLine()
:Cheers! Andy