isCData

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

function

function isCData(node: XmlNode): node is XmlCDataNode

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

node: XmlNode

The XML node to check.

Returns

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

Example: Usage

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

const node = { type: "cdata" as const, text: "<script>" };
assertEquals(isCData(node), true);

Source