TinyBase logoTinyBase

getValue

The getValue method returns a single keyed Value in the Store.

getValue(valueId: string): ValueOrUndefined
TypeDescription
valueIdstring

The Id of the Value in the Store.

returnsValueOrUndefined

The Value, or undefined.

Examples

This example retrieves a single Value.

import {createStore} from 'tinybase';

const store = createStore().setValues({open: true, employees: 3});
console.log(store.getValue('employees'));
// -> 3

This example retrieves a Value that does not exist, returning undefined.

import {createStore} from 'tinybase';

const store = createStore().setValues({open: true, employees: 3});
console.log(store.getValue('website'));
// -> undefined

Since

v3.0.0