Skip to content

Commit

Permalink
Merge pull request #890 from dermaaarkus/889-guarantee-get-returns-pr…
Browse files Browse the repository at this point in the history
…omise

implement guarantee get returns guarantee
  • Loading branch information
mxcl committed Jun 27, 2018
2 parents b367153 + 2c44682 commit f035696
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/Guarantee.swift
Expand Up @@ -76,6 +76,13 @@ public extension Guarantee {
}
return rg
}

func get(on: DispatchQueue? = conf.Q.return, flags: DispatchWorkItemFlags? = nil, _ body: @escaping (T) -> Void) -> Guarantee<T> {
return map(on: on, flags: flags) {
body($0)
return $0
}
}

func map<U>(on: DispatchQueue? = conf.Q.map, flags: DispatchWorkItemFlags? = nil, _ body: @escaping(T) -> U) -> Guarantee<U> {
let rg = Guarantee<U>(.pending)
Expand Down

0 comments on commit f035696

Please sign in to comment.