The obj class represents a "obj" JSON CRDT node. As the generic type parameter, it takes a record of node builders. The optional generic type parameter is a record of optional keys.

Example:

s.obj({
name: s.str(''),
age: s.con(0),
});

Specify optional keys as the second argument:

s.obj(
{
href: s.str('https://example.com'),
},
{
title: s.str(''),
},
)

Or, specify only the type, using the optional method:

s.obj({
href: s.str('https://example.com'),
})
.optional<nodes.obj({
title: nodes.str,
})>()

Type Parameters

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

Properties

obj: T
opt?: O
type: "obj" = 'obj'

Methods