MCPcopy
hub / github.com/TypeStrong/ts-node / once

Function once

src/test/testlib.ts:38–47  ·  view source on GitHub ↗
(func: T)

Source from the content-addressed store, hash-verified

36}
37
38function once<T extends Function>(func: T): T {
39 let run = false;
40 let ret: any = undefined;
41 return function (...args: any[]) {
42 if (run) return ret;
43 run = true;
44 ret = func(...args);
45 return ret;
46 } as any as T;
47}
48
49export const test = createTestInterface({
50 beforeEachFunctions: [],

Callers 4

register.spec.tsFile · 0.70
helpers.tsFile · 0.70
createTestInterfaceFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…