* Wrap the given wait function with the given mutation function, * while still allowing it to be mutated again in the future by * the inner opt_mutate function. * @param {function(CONDITION, function(VALUE): ?DERIVED): Promise } wait * @param {function(VALUE): MUTANT} mutate * @return {func
(wait, mutate)
| 77 | * @template RES |
| 78 | */ |
| 79 | function wrapWait(wait, mutate) { |
| 80 | return (condition, opt_mutate) => { |
| 81 | opt_mutate = opt_mutate || ((x) => /** @type {*} */ (x)); |
| 82 | return wait(condition, (value) => opt_mutate(mutate(value))); |
| 83 | }; |
| 84 | } |
| 85 | |
| 86 | module.exports = { |
| 87 | ControllerPromise, |