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

Function times

packages/socket.io-redis-streams-emitter/test/util.ts:9–19  ·  view source on GitHub ↗
(count: number, fn: () => void)

Source from the content-addressed store, hash-verified

7import { createAdapter } from "@socket.io/redis-streams-adapter";
8
9export function times(count: number, fn: () => void) {
10 let i = 0;
11 return () => {
12 i++;
13 if (i === count) {
14 fn();
15 } else if (i > count) {
16 throw new Error(`too many calls: ${i} instead of ${count}`);
17 }
18 };
19}
20
21export function sleep(duration: number) {
22 return new Promise((resolve) => setTimeout(resolve, duration));

Callers 1

index.tsFile · 0.90

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected