Skip to content

operators: add compactScan() and tryCompactScan() #100

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

twittemb
Copy link
Member

@twittemb twittemb commented Sep 4, 2021

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 twittemb force-pushed the feature/compactScan branch from 078ae29 to d4c2bf1 Compare September 4, 2021 16:41
@codecov
Copy link

codecov bot commented Sep 4, 2021

Codecov Report

Merging #100 (a8cd51e) into main (665fc63) will increase coverage by 0.05%.
The diff coverage is 100.00%.

❗ 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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant