TinyBase logoTinyBase

hasRow

The hasRow method returns a boolean indicating whether a given Row exists in the Store.

hasRow(
  tableId: Id,
  rowId: Id,
): boolean
TypeDescription
tableIdId

The Id of a possible Table in the Store.

rowIdId

The Id of a possible Row in the Table.

returnsboolean

Whether a Row with that Id exists in that Table.

Example

This example shows two simple Row existence checks.

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