UNPKG

predictype

Version:

PredicType is a library of pre-built and tested predicates for TypeScript, covering various data types and operations.

20 lines (19 loc) 933 B
import { ObjectPropertyOper } from '../../enums/objects.js'; /** * Checks if an object has or lacks a property (own or inherited) using the specified operation. * * @param source The object to check. * @param oper The property operation to perform (e.g. 'contains_property', 'lacks_own_property'). * @param key The property key to check. * @returns True if the property check is valid according to the operator, otherwise false. * * @throws {Error} If the operation is not recognized. * * @remarks * Supported Operators: * - **CONTAINS_PROPERTY**: Object has the property (own or inherited) * - **LACKS_PROPERTY**: Object lacks the property (own or inherited) * - **CONTAINS_OWN_PROPERTY**: Object has the property as own property * - **LACKS_OWN_PROPERTY**: Object lacks the property as own property */ export declare function objectProperty(source: object, oper: ObjectPropertyOper, key: string | symbol): boolean;