UNPKG

@lou.codes/predicates

Version:
17 lines (16 loc) 506 B
import { hasOwn } from "@lou.codes/constants/Object.js"; /** * Check if the given key is present in the given object (not inherited). * * @category Predicates * @category Objects * @example * ```typescript * const isPropertyOfFoo = isPropertyOf({ "🟢": "🟩" }); * isPropertyOfFoo("🟢"); // true * isPropertyOfFoo("🟩"); // false * ``` * @param object Object to check. * @returns Curried function with `context` set. */ export const isPropertyOf = object => key => hasOwn(object, key);