function isDone
isDone(reply: Reply): reply is DoneReply

Checks if a reply is a done reply

Type guard function that narrows the Reply type to DoneReply.

Examples

Use type guard to narrow reply type

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

const reply = parseReply(["!done", ".tag=abc123"]);
if (isDone(reply)) {
  // TypeScript knows reply is DoneReply here
  assertEquals(reply.attributes?.[".tag"], "abc123");
}

Parameters

reply: Reply

The reply to check

Return Type

reply is DoneReply

True if the reply is a DoneReply

Usage

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