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

Function getAddMinMaxMutator

test/unit/core/store/store-schema.test.ts:56–72  ·  view source on GitHub ↗
(
    tableId: Id,
    cellId: Id,
    {min, max}: {min?: number; max?: number},
  )

Source from the content-addressed store, hash-verified

54
55const getAddMinMaxMutator =
56 (
57 tableId: Id,
58 cellId: Id,
59 {min, max}: {min?: number; max?: number},
60 ): AddMutator =>
61 (store) =>
62 store.addRowListener(
63 tableId,
64 null,
65 (store, tableId, rowId) => {
66 let cell = store.getCell(tableId, rowId, cellId) as number;
67 cell = min != null ? Math.max(min, cell as number) : cell;
68 cell = max != null ? Math.min(max, cell as number) : cell;
69 store.setCell(tableId, rowId, cellId, cell);
70 },
71 true,
72 );
73
74const cellBoundsSchemaAndExpected: [
75 name: string,

Callers 1

Calls 3

addRowListenerMethod · 0.65
getCellMethod · 0.65
setCellMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…