A useful convenience would be adding a *[Symbol.iterator]() method for a friendlier and more idiomatic API compared to the current nextBreak-based one.
console.log([...new LineBreaker('...')]); // [{ position: 3, required: false, substring: '...' }]
for (const bk of new LineBreaker('...')) {
console.log(bk); // { position: 3, required: false, substring: '...' }
}
A useful convenience would be adding a
*[Symbol.iterator]()method for a friendlier and more idiomatic API compared to the currentnextBreak-based one.