am_length: Get the length of an Automerge map or list

View source: R/objects.R

am_lengthR Documentation

Get the length of an Automerge map or list

Description

Returns the number of key-value pairs in a map or elements in a list.

Usage

am_length(doc, obj)

Arguments

doc

An Automerge document

obj

An Automerge object ID, or AM_ROOT for the document root

Value

Integer length/size

Examples

doc <- am_create()

am_put(doc, AM_ROOT, "a", 1)
am_put(doc, AM_ROOT, "b", 2)

len <- am_length(doc, AM_ROOT)
len  # 2

am_close(doc)


automerge documentation built on Feb. 5, 2026, 5:08 p.m.