isText

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

function

function isText(node: XmlNode): node is XmlTextNode

Type guard to check if a node is a text node.

node: XmlNode

The XML node to check.

Returns

true if the node is a text node, false otherwise.

Example: Usage

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

const node = { type: "text" as const, text: "Hello" };
assertEquals(isText(node), true);

Source