You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In addition to the above, the document object also provides the same **accessor methods** as [collections](#collections), based on the top-level collection:
128
-
`add`, `delete`, `get`, `has`, and `set`.
127
+
`delete`, `get`, `has`, and `set`.
129
128
130
129
#### `Document#toJS()`, `Document#toJSON()` and `Document#toString()`
| add(value) |`void`| Adds a value to the collection. For `!!map` and `!!omap` the value must be a Pair instance, which must not have a key that already exists in the map. |
97
94
| delete(key) |`boolean`| Removes a value from the collection. Returns `true` if the item was found and removed. |
98
95
| get(key) |`Node`| Returns value at `key`, or `undefined` if not found. |
99
96
| has(key) |`boolean`| Checks if the collection includes a value with the key `key`. |
97
+
| push(...values) |`number`| Adds values to the collection. For `!!map` and `!!omap` the value must be a Pair instance, which must not have a key that already exists in the map. |
100
98
| set(key, value) |`any`| Sets a value in this collection. For `!!set`, `value` needs to be a boolean to add/remove the item from the set. When overwriting a `Scalar` value with a scalar, the original node is retained. |
0 commit comments