Made SplitStreamSequence work across multiple chunks for strings #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(Hi again, sorry for the previous pull request, but apparently I still stumbled across a different problem ;) )
In my use-case of Lazy I'm reading a file that needs to be split into large pieces. The chunks that the stream spits out are smaller than the pieces I need. At the moment Lazy.js splits on each chunk separately, which results in Lazy spitting out the chunks as-is, instead of actual splitted pieces.
This also goes for line-splitting. There can be multiple lines inside one chunk. Most of those will be correct, but the lines that span across 2 chunks will be incorrect as far as I've seen.
This patch contains a solution for this by concatenating chunks and looking up the divider inside that concatenation. It also includes a test that fails with the earlier code and passes with the code in this patch.
However, some other tests fail. This is because I have only implemented a solution for string-dividers, not regexp-dividers! I need some hints as to how to solve this for regexp-dividers, since those don't have a constant length. Maybe for regexp dividers it should just fallback to the existing implementation, but that's somewhat confusing as you don't expect the output to be like this. Let me know what you think!