Function
createPartialDone
(done: (err?: Error) => void, count: number)
Source from the content-addressed store, hash-verified
| 10 | import { assert } from "./support/util"; |
| 11 | |
| 12 | const createPartialDone = (done: (err?: Error) => void, count: number) => { |
| 13 | let i = 0; |
| 14 | return () => { |
| 15 | if (++i === count) { |
| 16 | done(); |
| 17 | } else if (i > count) { |
| 18 | done(new Error(`partialDone() called too many times: ${i} > ${count}`)); |
| 19 | } |
| 20 | }; |
| 21 | }; |
| 22 | |
| 23 | const shouldNotHappen = (done) => () => done(new Error("should not happen")); |
| 24 | |
Tested by
no test coverage detected