TinyBase logoTinyBase β

hasRow

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

hasRow(
  tableId: string,
  rowId: string,
): boolean
TypeDescription
tableIdstring

The Id of a possible Table in the Store.

rowIdstring

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.

import {createStore} from 'tinybase';

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

Since

v1.0.0