|
112 | 112 | * `null` since v7.0, or `object` or `array` since v8.0), and what the default |
113 | 113 | * value can be when an explicit value is not specified. |
114 | 114 | * |
115 | | - * For `object` and `array` types, TinyBase automatically serializes values |
116 | | - * to and from JSON when storing and retrieving them. |
| 115 | + * For `object` and `array` types, TinyBase automatically serializes values to |
| 116 | + * and from JSON when storing and retrieving them. |
117 | 117 | * |
118 | 118 | * If a default value is provided (and its type is correct), you can be certain |
119 | 119 | * that the Value will always be present in a Store. |
|
289 | 289 | * |
290 | 290 | * A Cell is used when setting a cell with the setCell method, and when getting |
291 | 291 | * it back out again with the getCell method. A Cell is a JavaScript string, |
292 | | - * number, boolean; or null since v7.0. |
| 292 | + * number, boolean, or null (since v7.0), or a plain JavaScript object or array |
| 293 | + * (since v8.0). |
293 | 294 | * @example |
294 | 295 | * ```js |
295 | 296 | * import type {Cell} from 'tinybase'; |
|
335 | 336 | * |
336 | 337 | * A Value is used when setting a value with the setValue method, and when |
337 | 338 | * getting it back out again with the getValue method. A Value is a JavaScript |
338 | | - * string, number, boolean; or null since v7.0. |
| 339 | + * string, number, boolean, or null (since v7.0), or a plain JavaScript object |
| 340 | + * or array (since v8.0). |
339 | 341 | * @example |
340 | 342 | * ```js |
341 | 343 | * import type {Value} from 'tinybase'; |
|
1222 | 1224 | * transaction, primarily used so that you can indicate whether the transaction |
1223 | 1225 | * should be rolled back. |
1224 | 1226 | * |
1225 | | - * It provides both the old and new Values in a two-part array. These |
1226 | | - * describe the state of the changed Value in the Store at the _start_ of the |
| 1227 | + * It provides both the old and new Values in a two-part array. These describe |
| 1228 | + * the state of the changed Value in the Store at the _start_ of the |
1227 | 1229 | * transaction, and by the _end_ of the transaction. |
1228 | 1230 | * |
1229 | 1231 | * Hence, an `undefined` value for the first item in the array means that the |
|
1511 | 1513 | * |
1512 | 1514 | * The keyed value support is best thought of as a flat JavaScript object. The |
1513 | 1515 | * Store contains a number of Value objects, each with a unique ID, and which is |
1514 | | - * a string, boolean, number; or null since v7.0. |
| 1516 | + * a string, boolean, number, null (since v7.0), or a plain JavaScript object or |
| 1517 | + * array (since v8.0). |
1515 | 1518 | * |
1516 | 1519 | * ```json |
1517 | | - * { // Store |
1518 | | - * "value1": "one", // Value (string) |
1519 | | - * "value2": true, // Value (boolean) |
1520 | | - * "value3": 3, // Value (number) |
1521 | | - * "value4": null, // Value (null since v7.0) |
| 1520 | + * { // Store |
| 1521 | + * "value1": "one", // Value (string) |
| 1522 | + * "value2": true, // Value (boolean) |
| 1523 | + * "value3": 3, // Value (number) |
| 1524 | + * "value4": null, // Value (null since v7.0) |
| 1525 | + * "value5": {"x": 1}, // Value (object since v8.0) |
| 1526 | + * "value6": [1, 2, 3], // Value (array since v8.0) |
1522 | 1527 | * ... |
1523 | 1528 | * } |
1524 | 1529 | * ``` |
|
1535 | 1540 | * - Each Table contains a number of Row objects. |
1536 | 1541 | * - Each Row contains a number of Cell objects. |
1537 | 1542 | * |
1538 | | - * A Cell is a string, boolean, number; or null since v7.0. |
| 1543 | + * A Cell is a string, boolean, number, null (since v7.0), or a plain JavaScript |
| 1544 | + * object or array (since v8.0). |
1539 | 1545 | * |
1540 | 1546 | * The members of each level of this hierarchy are identified with a unique Id |
1541 | 1547 | * (which is a string). In other words you can naively think of a Store as a |
|
1549 | 1555 | * "cell2": true, // Cell (boolean) |
1550 | 1556 | * "cell3": 3, // Cell (number) |
1551 | 1557 | * "cell4": null, // Cell (null since v7.0) |
| 1558 | + * "cell5": {"x": 1}, // Cell (object since v8.0) |
| 1559 | + * "cell6": [1, 2, 3], // Cell (array since v8.0) |
1552 | 1560 | * ... |
1553 | 1561 | * }, |
1554 | 1562 | * ... |
|
3069 | 3077 | * does not match a TablesSchema associated with the Store), will be ignored |
3070 | 3078 | * silently. |
3071 | 3079 | * |
3072 | | - * As well as string, number, or boolean Cell types, this method can also take |
3073 | | - * a MapCell function that takes the current Cell value as a parameter and |
3074 | | - * maps it. This is useful if you want to efficiently increment a value |
3075 | | - * without fetching it first, for example. |
| 3080 | + * As well as string, number, boolean, null, object, and array Cell types, |
| 3081 | + * this method can also take a MapCell function that takes the current Cell |
| 3082 | + * value as a parameter and maps it. This is useful if you want to efficiently |
| 3083 | + * increment a value without fetching it first, for example. |
3076 | 3084 | * |
3077 | 3085 | * The method returns a reference to the Store so that subsequent operations |
3078 | 3086 | * can be chained in a fluent style. |
|
3234 | 3242 | * If the Value is invalid (either because of its type, or because it does not |
3235 | 3243 | * match a ValuesSchema associated with the Store), will be ignored silently. |
3236 | 3244 | * |
3237 | | - * As well as string, number, or boolean Value types, this method can also |
3238 | | - * take a MapValue function that takes the current Value as a parameter and |
3239 | | - * maps it. This is useful if you want to efficiently increment a value |
3240 | | - * without fetching it first, for example. |
| 3245 | + * As well as string, number, boolean, null, object, and array Value types, |
| 3246 | + * this method can also take a MapValue function that takes the current Value |
| 3247 | + * as a parameter and maps it. This is useful if you want to efficiently |
| 3248 | + * increment a value without fetching it first, for example. |
3241 | 3249 | * |
3242 | 3250 | * The method returns a reference to the Store so that subsequent operations |
3243 | 3251 | * can be chained in a fluent style. |
|
0 commit comments