edgeport - v1.0.6
    Preparing search index...

    Function el

    • Builds an XmlElement. Nullish children are dropped and arrays are flattened, so conditional children (cond ? el(...) : null) and spread lists compose cleanly.

      Parameters

      • name: string

        The tag name (include a prefix if needed, e.g. stream:features).

      • attrs: Record<string, string> = {}

        Attribute map; omit or pass {} for none.

      • ...children: (XmlNode | (XmlNode | null | undefined)[] | null | undefined)[]

        Child elements or text; null/undefined are skipped, arrays flattened.

      Returns XmlElement

      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>