Builds an XmlElement. Nullish children are dropped and arrays are flattened, so conditional children (cond ? el(...) : null) and spread lists compose cleanly.
cond ? el(...) : null
The tag name (include a prefix if needed, e.g. stream:features).
stream:features
Attribute map; omit or pass {} for none.
{}
Child elements or text; null/undefined are skipped, arrays flattened.
null
undefined
The constructed element.
1.0.4
import { el, serialize } from 'edgeport/xmpp';const iq = el('iq', { type: 'get', id: '1' }, el('query', { xmlns: 'jabber:iq:roster' }));serialize(iq); // <iq type="get" id="1"><query xmlns="jabber:iq:roster"/></iq> Copy
import { el, serialize } from 'edgeport/xmpp';const iq = el('iq', { type: 'get', id: '1' }, el('query', { xmlns: 'jabber:iq:roster' }));serialize(iq); // <iq type="get" id="1"><query xmlns="jabber:iq:roster"/></iq>
Builds an XmlElement. Nullish children are dropped and arrays are flattened, so conditional children (
cond ? el(...) : null) and spread lists compose cleanly.