(promise, ms)
| 209 | }, |
| 210 | |
| 211 | promiseWithTimeout(promise, ms) { |
| 212 | const timeoutPromise = new Promise((_resolve, reject) => { |
| 213 | setTimeout(() => reject(new Error(`Promise timed out after ${ms}ms.`)), ms); |
| 214 | }); |
| 215 | return Promise.race([promise, timeoutPromise]); |
| 216 | }, |
| 217 | |
| 218 | // Make an idempotent function. |
| 219 | makeIdempotent(func) { |
nothing calls this directly
no test coverage detected