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

Function times

packages/socket.io-adapter/test/util.ts:1–11  ·  view source on GitHub ↗
(count: number, fn: () => void)

Source from the content-addressed store, hash-verified

1export function times(count: number, fn: () => void) {
2 let i = 0;
3 return () => {
4 i++;
5 if (i === count) {
6 fn();
7 } else if (i > count) {
8 throw new Error(`too many calls: ${i} instead of ${count}`);
9 }
10 };
11}
12
13export function shouldNotHappen(done) {
14 return () => done(new Error("should not happen"));

Callers 1

cluster-adapter.tsFile · 0.90

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected