refactor: centralize isPlainObject, isRecord, isErrno, isLoopbackHost utilities (#12926)

This commit is contained in:
max
2026-02-09 17:02:55 -08:00
committed by GitHub
parent 70f9edeec7
commit 8d75a496bf
37 changed files with 97 additions and 226 deletions

View File

@@ -1,5 +1,6 @@
import { spawn } from "node:child_process";
import net from "node:net";
import { isErrno } from "./errors.js";
import { ensurePortAvailable } from "./ports.js";
export type SshParsedTarget = {
@@ -17,10 +18,6 @@ export type SshTunnel = {
stop: () => Promise<void>;
};
function isErrno(err: unknown): err is NodeJS.ErrnoException {
return Boolean(err && typeof err === "object" && "code" in err);
}
export function parseSshTarget(raw: string): SshParsedTarget | null {
const trimmed = raw.trim().replace(/^ssh\s+/, "");
if (!trimmed) {