TinyBase logoTinyBase

getValues

The getValues method returns an object containing the entire set of keyed Values in the Store.

getValues(): Values
returnsValues

An object containing the set of keyed Values in the Store.

Note that this returns a copy of, rather than a reference to the underlying data, so changes made to the returned object are not made to the Store itself.

Examples

This example retrieves the set of keyed Values in the Store.

import {createStore} from 'tinybase';

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

This example retrieves Values from a Store that has none, returning an empty object.

import {createStore} from 'tinybase';

const store = createStore();
console.log(store.getValues());
// -> {}

Since

v3.0.0