TinyBase logoTinyBase

hasTableCell

The hasTableCell method returns a boolean indicating whether a given Cell exists anywhere in a Table, not just in a specific Row.

hasTableCell(
  tableId: Id,
  cellId: Id,
): boolean
TypeDescription
tableIdId

The Id of a possible Table in the Store.

cellIdId

The Id of a possible Cell in the Table.

returnsboolean

Whether a Cell with that Id exists anywhere in that Table.

Example

This example shows two simple Cell existence checks.

const store = createStore().setTables({
  pets: {fido: {species: 'dog'}, felix: {legs: 4}},
});
console.log(store.hasTableCell('pets', 'species'));
// -> true
console.log(store.hasTableCell('pets', 'legs'));
// -> true
console.log(store.hasTableCell('pets', 'color'));
// -> false

Since

v3.3.0