TinyBase logoTinyBase β

Value

The Value type is the data structure representing the data in a single keyed value.

string | number | boolean | null | AnyObject | AnyArray

A Value is used when setting a value with the setValue method, and when getting it back out again with the getValue method. A Value is a JavaScript string, number, boolean, or null (since v7.0), or a plain JavaScript object or array (since v8.0).

Object and array contents should recursively be strings, finite numbers, booleans, null, plain objects, or arrays. TinyBase validates the top-level container and then uses JSON serialization, so other nested values can be changed or omitted. If the value cannot be serialized, the Value is invalid and the write is ignored silently.

String Values must not start with the Unicode replacement character U+FFFD, which TinyBase reserves for its internal object and array encoding, or be the exact Unicode object replacement character U+FFFC, which TinyBase reserves to represent undefined in serialized data.

Example

import type {Value} from 'tinybase';

export const value: Value = 'dog';

Since

v3.0.0