operators: add compactScan() and tryCompactScan()
This PR adds a compactScan() and a tryCompactScan() operators.
compactScan() transforms elements from the upstream publisher by providing the current element to a closure along with the last value returned by the closure. If the closure returns a nil value, then the accumulator won't change until the next non-nil upstream publisher value.
The tryCompactScan() version behaves the same but with a throwing closure.
Codecov Report
Merging #100 (a8cd51e) into main (665fc63) will increase coverage by
0.05%. The diff coverage is100.00%.
:exclamation: Current head a8cd51e differs from pull request most recent head 9e20a3f. Consider uploading reports for the commit 9e20a3f to get more accurate results
@@ Coverage Diff @@
## main #100 +/- ##
==========================================
+ Coverage 97.12% 97.18% +0.05%
==========================================
Files 62 64 +2
Lines 3338 3408 +70
==========================================
+ Hits 3242 3312 +70
Misses 96 96
| Impacted Files | Coverage Δ | |
|---|---|---|
| Sources/Operators/CompactScan.swift | 100.00% <100.00%> (ø) |
|
| Tests/CompactScanTests.swift | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 665fc63...9e20a3f. Read the comment docs.