import type {Unverified} from '../type/unverified.js'; import {isObject} from './guard/is-object.js'; export function isGenerator( value: unknown, ): value is Generator { if (!isObject(value)) { return false; } const unverifiedValue: Unverified> = value; return ( typeof unverifiedValue.next === 'function' && typeof unverifiedValue.return === 'function' && typeof unverifiedValue.throw === 'function' ); }