All files / io / _common.ts

100.00% Branches 1/1
100.00% Lines 5/5
1
2
3
4
5
6
7
8
9
10
11
 
 
 
 
 
x4
x12
x12
 
x12
x12









// Copyright 2018-2025 the Deno authors. MIT license.
// This module is browser compatible.

import type { Closer } from "./types.ts";

export function isCloser(value: unknown): value is Closer {
  return typeof value === "object" && value !== null && value !== undefined &&
    "close" in value &&
    // deno-lint-ignore no-explicit-any
    typeof (value as Record<string, any>)["close"] === "function";
}