obj<F extends XmlFields>(fields: F): XmlField<XmlFieldsValue<F>>
A nested element with fields of its own.
Read a nested element
Read a nested element
import { assertEquals } from "@std/assert"; import { parse } from "@std/xml"; import { int, obj } from "@hertzg/reolink-api/protocol/xml"; const range = obj({ min: int(), max: int() }); const parent = parse("<p><speed><min>1</min><max>64</max></speed></p>").root; assertEquals(range.decode("speed", parent), { min: 1, max: 64 });
F extends XmlFields
fields: F
The nested element's field codecs.
A field codec for the nested object.