function isData
isData(reply: Reply): reply is DataReply

Checks if a reply is a data reply

Type guard function that narrows the Reply type to DataReply.

Examples

Use type guard to access data attributes

import { assertEquals } from "@std/assert";
import { parseReply, isData } from "@hertzg/routeros-api/protocol/reply";

const reply = parseReply(["!re", "=name=ether1"]);
if (isData(reply)) {
  // TypeScript knows reply.attributes is defined here
  assertEquals(reply.attributes.name, "ether1");
}

Parameters

reply: Reply

The reply to check

Return Type

reply is DataReply

True if the reply is a DataReply

Usage

import { isData } from "protocol/reply.ts";