CombineExt icon indicating copy to clipboard operation
CombineExt copied to clipboard

operators: add compactScan() and tryCompactScan()

Open twittemb opened this issue 4 years ago • 1 comments

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.

twittemb avatar Sep 04 '21 16:09 twittemb

Codecov Report

Merging #100 (a8cd51e) into main (665fc63) will increase coverage by 0.05%. The diff coverage is 100.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 Impacted file tree graph

@@            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 data Powered by Codecov. Last update 665fc63...9e20a3f. Read the comment docs.

codecov[bot] avatar Sep 04 '21 16:09 codecov[bot]