AwaitKit
AwaitKit copied to clipboard
Support awaiting optional Promises
This PR adds support for await
ing optional promises, which allows for optional chaining inside an await
function, like so:
try await(self.foo?.bar())
If the promise is nil
, await
immediately returns nil
and does nothing more; otherwise it executes the promise as normal and returns an Optional
wrapping the awaited value. This is implemented for both Promise
s and Guarantee
s.
This should resolve #19 — please let me know what you think, and thank you for providing this library!
Codecov Report
Merging #49 into master will decrease coverage by
2.35%
. The diff coverage is80%
.
@@ Coverage Diff @@
## master #49 +/- ##
==========================================
- Coverage 100% 97.64% -2.36%
==========================================
Files 4 4
Lines 75 85 +10
==========================================
+ Hits 75 83 +8
- Misses 0 2 +2
Impacted Files | Coverage Δ | |
---|---|---|
Sources/AwaitKit/AwaitKit.swift | 90% <80%> (-10%) |
:arrow_down: |
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 743fbf2...d7dbe94. Read the comment docs.
Hey @yannickl, what's the status on this PR? Thanks 😄