MCPcopy
hub / github.com/tinyplex/tinybase / getPoolFunctions

Function getPoolFunctions

src/common/pool.ts:10–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8export type PoolFunctions = [(reuse: 0 | 1) => Id, (id: Id) => void];
9
10export const getPoolFunctions = (): PoolFunctions => {
11 const pool: Ids = [];
12 let nextId = 0;
13 return [
14 (reuse: 0 | 1): Id =>
15 (reuse ? arrayShift(pool) : null) ?? EMPTY_STRING + nextId++,
16 (id: Id): void => {
17 if (test(INTEGER, id) && size(pool) < 1e3) {
18 arrayPush(pool, id);
19 }
20 },
21 ];
22};

Callers 4

setValidTableFunction · 0.90
getOrCreateTableFunction · 0.90
getListenerFunctionsFunction · 0.90
CartesianChartFunction · 0.90

Calls 4

arrayShiftFunction · 0.90
testFunction · 0.90
sizeFunction · 0.90
arrayPushFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…