The string to iterate through
import newlineIterator from "newline-iterator";
const iterator = newlineIterator("some\r\nstring\ncombination\r");
const results = [];
for (const line of iterator) results.push(line);
console.log(results); // ["some", "string", "combination"];
Create a newline iterator recognizing CR, LF, and CRLF using the Symbol.iterator interface