File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -485,6 +485,15 @@ export function isNodeJSErrnoException(error: unknown): error is NodeJS.ErrnoExc
485
485
return error !== undefined && ( error as NodeJS . ErrnoException ) . code !== undefined
486
486
}
487
487
488
+ /**
489
+ * A helper function which returns a boolean indicating whether
490
+ * the given address is AddressInfo and has .address
491
+ * and a .port property.
492
+ */
493
+ export function isAddressInfo ( address : unknown ) : address is net . AddressInfo {
494
+ return address !== null && typeof address !== "string" && ( address as net . AddressInfo ) . port !== undefined
495
+ }
496
+
488
497
// TODO: Replace with proper templating system.
489
498
export const escapeJSON = ( value : cp . Serializable ) => JSON . stringify ( value ) . replace ( / " / g, """ )
490
499
You can’t perform that action at this time.
0 commit comments