getTableId
The getTableId method returns the Id of the underlying Table that is backing a Metric.
getTableId(metricId: string): undefined | string| Type | Description | |
|---|---|---|
metricId | string | |
| returns | undefined | string |
If the Metric Id is invalid, the method returns undefined.
Example
This example creates a Metrics object, a single Metric definition, and then queries it (and a non-existent definition) to get the underlying Table Id.
import {createMetrics, createStore} from 'tinybase';
const metrics = createMetrics(createStore());
metrics.setMetricDefinition('speciesCount', 'species');
console.log(metrics.getTableId('speciesCount'));
// -> 'species'
console.log(metrics.getTableId('petsCount'));
// -> undefined
Since
v1.0.0