isDone(reply: Reply): reply is DoneReply
Checks if a reply is a done reply
Type guard function that narrows the Reply type to DoneReply.
Use type guard to narrow reply type
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"); }
reply: Reply
The reply to check
reply is DoneReply
True if the reply is a DoneReply