TinyBase logoTinyBase

hasCell

The hasCell method returns a boolean indicating whether a given Cell exists in a given Row in a given Table.

hasCell(
  tableId: Id,
  rowId: Id,
  cellId: Id,
): boolean
TypeDescription
tableIdId

The Id of a possible Table in the Store.

rowIdId

The Id of a possible Row in the Table.

cellIdId

The Id of a possible Cell in the Row.

returnsboolean

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

Example

This example shows two simple Cell existence checks.

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