{"version":3,"sources":["../../src/functions/hasKey/hasKey.ts"],"names":[],"mappings":";AAaO,SAAS,OAGd,OAAU,KAAyC;AACnD,MAAI,OAAO,UAAU,YAAY,SAAS,MAAM;AAC9C,WAAO;AAAA,EACT;AAEA,SAAO,OAAO;AAChB","sourcesContent":["import { KeysOfUnion, StringWithAutocomplete } from '../../types';\n\n/**\n * Returns whether the input value has the specified key.\n * @param value The value to check.\n * @param key The key to check for.\n * @returns Whether the input value has the specified key.\n * @example\n * ```ts\n * hasKey({ a: 1 }, 'a') // true\n * hasKey({ a: 1 }, 'b') // false\n * ```\n */\nexport function hasKey<\n  T extends object,\n  K extends StringWithAutocomplete<KeysOfUnion<T> & string> | PropertyKey,\n>(value: T, key: K): value is T & Record<K, unknown> {\n  if (typeof value !== 'object' || value == null) {\n    return false;\n  }\n\n  return key in value;\n}\n"]}