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

The Id of a possible Table in the Store.

rowIdstring

The Id of a possible Row in the Table.

cellIdstring

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.

import {createStore} from 'tinybase';

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

Since

v1.0.0