New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map extension #68
Comments
Hi Tiago, What kind of a Map extension would you like to see? Any examples? Perhaps we already have what you need? Thanks. |
I'm converting my project from PromiseKit to Promises and in some places where I used PromiseKit extensions like map, mapValues, compactMap and compactMapValues was needed some more imperative code. Maybe I'm missing something but here are a code comparation. Note that I opted for explicit closure typed because compiler was pain on guess it.
agains
Same without explicit types:
|
Many thanks for the example! Wonder if you could leverage return userDBManager.getAllPromise().then(on: bgq) {
$0?.first?.selectedMachines?.compactMap { $0 as? MachineMO }?.compactMap(toMachine) ?? []
} |
Really better, great solution! It solved the problem and keeps the code elegant and simple. Thanks! |
There is any intention to provide a Map extension?
The text was updated successfully, but these errors were encountered: