MCPcopy Index your code
hub / github.com/redis/node-redis / restrictFunctionCalls

Function restrictFunctionCalls

examples/transaction-with-watch.js:7–12  ·  view source on GitHub ↗
(fn, maxCalls)

Source from the content-addressed store, hash-verified

5await client.connect();
6
7function restrictFunctionCalls(fn, maxCalls) {
8 let count = 1;
9 return function (...args) {
10 return count++ < maxCalls ? fn(...args) : false;
11 };
12}
13
14const fn = restrictFunctionCalls(transaction, 4);
15

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected