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

Function setCells

test/unit/core/other/queries.test.ts:19–58  ·  view source on GitHub ↗
(
  tableId: Id = 't1',
  cellIdSuffix = '',
  stringSuffix = '',
  numberPrefix = '',
)

Source from the content-addressed store, hash-verified

17});
18
19const setCells = (
20 tableId: Id = 't1',
21 cellIdSuffix = '',
22 stringSuffix = '',
23 numberPrefix = '',
24) => {
25 const cellId = (cellId: Id) => `${cellId}${cellIdSuffix}`;
26 const string = (string: Id) => `${string}${stringSuffix}`;
27 const number = (number: number) =>
28 numberPrefix === '' ? number : `${numberPrefix}${number}`;
29
30 const r1 = {
31 [cellId('c1')]: string('one'),
32 [cellId('c2')]: string('odd'),
33 [cellId('c3')]: number(1),
34 };
35
36 if (store.hasTables()) {
37 store.setRow(tableId, 'r1', r1);
38 } else {
39 store.setTables({[tableId]: {r1}});
40 }
41 store
42 .setTable(tableId, {
43 r2: {
44 [cellId('c1')]: string('two'),
45 [cellId('c2')]: string('even'),
46 [cellId('c3')]: number(2),
47 },
48 r3: {
49 [cellId('c1')]: string('three'),
50 [cellId('c2')]: string('odd'),
51 [cellId('c3')]: number(3),
52 },
53 })
54 .setRow(tableId, 'r1', r1)
55 .setCell(tableId, 'r4', cellId('c1'), string('four'))
56 .setCell(tableId, 'r4', cellId('c2'), string('even'))
57 .setCell(tableId, 'r4', cellId('c3'), number(4));
58};
59
60const delCells = (tableId: Id = 't1') => {
61 const cellId = (cellId: Id, cellIdSuffix = '') => `${cellId}${cellIdSuffix}`;

Callers 1

queries.test.tsFile · 0.70

Calls 8

stringFunction · 0.85
numberFunction · 0.85
cellIdFunction · 0.70
hasTablesMethod · 0.65
setRowMethod · 0.65
setTablesMethod · 0.65
setCellMethod · 0.65
setTableMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…