MCPcopy
hub / github.com/socketio/socket.io / createPartialDone

Function createPartialDone

packages/socket.io/test/uws.ts:12–21  ·  view source on GitHub ↗
(done: (err?: Error) => void, count: number)

Source from the content-addressed store, hash-verified

10import { assert } from "./support/util";
11
12const 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
23const shouldNotHappen = (done) => () => done(new Error("should not happen"));
24

Callers 1

uws.tsFile · 0.70

Calls 1

doneFunction · 0.85

Tested by

no test coverage detected