powered by
Retrieves a value from an Automerge map or list. Returns NULL if the key or index doesn't exist.
NULL
am_get(doc, obj, key)
The value at the specified key/position, or NULL if not found. Nested objects are returned as am_object instances.
am_object
An Automerge document
An Automerge object ID (from nested object), or AM_ROOT for the document root
AM_ROOT
For maps: character string key. For lists: numeric index (1-based). Returns NULL for indices <= 0 or beyond list length.
<= 0
doc <- am_create() am_put(doc, AM_ROOT, "name", "Alice") name <- am_get(doc, AM_ROOT, "name") name # "Alice" am_close(doc)
Run the code above in your browser using DataLab