import { isFunction } from "./isFunction"; import { isString } from "./isString"; export function hasKey(obj: object, key: K): obj is Record { return key in obj; } export function hasStringAtKey(obj: object, key: K): obj is Record { return hasKey(obj, key) && isString(obj[key]); } export function hasValueAtKey(obj: object, key: K, value: unknown): obj is Record { return hasKey(obj, key) && obj[key] === value; } export function hasFunctionAtKey(obj: object, key: K): obj is Record any> { return hasKey(obj, key) && isFunction(obj[key]); }