isElement

import { isElement } from "jsr:@ende/xml";

function

function isElement(node: XmlNode): node is XmlElement

Type guard to check if a node is an element.

node: XmlNode

The XML node to check.

Returns

true if the node is an element, false otherwise.

Example: Usage

import { isElement } from "@ende/xml/types";
import { assertEquals } from "@ende/assert";

const node = { type: "element" as const, name: { raw: "item", local: "item" }, attributes: {}, children: [] };
assertEquals(isElement(node), true);

Source