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: string,
  cellId: string,
): boolean
TypeDescription
tableIdstring

The Id of a possible Table in the Store.

cellIdstring

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.

import {createStore} from 'tinybase';

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