predictype
Version:
PredicType is a library of pre-built and tested predicates for TypeScript, covering various data types and operations.
17 lines (16 loc) • 653 B
TypeScript
import { ObjectStateOper } from '../../enums/objects.js';
/**
* Checks state-related properties of an object (is_empty, is_not_empty, is_plain, is_frozen, is_sealed).
*
* @param source The object to check.
* @param oper The state operation to perform.
* @returns True if the state check is valid according to the operator, otherwise false.
*
* @throws {Error} If the operation is not recognized.
*
* @example
* objectState({}, 'is_empty'); // true
* objectState({ a: 1 }, 'is_not_empty'); // true
* objectState(Object.freeze({}), 'is_frozen'); // true
*/
export declare function objectState(source: object, oper: ObjectStateOper): boolean;