import { type PrimativeKey, type FieldOfType } from '../key'; import { type SetIncludesMode } from '../set/set.mode'; import { type KeyAsString } from '../type'; /** * Any valid Plain-old Javascript Object key. */ export type POJOKey = PrimativeKey | symbol; /** * This is an object that can be serialized to JSON and back and be equivalent. */ export type JsonSerializableObject = Record; /** * String key of an object. * * @semanticType * @semanticTopic identifier * @semanticTopic string */ export type ObjectKey = string; /** * An object with no keys. */ export type EmptyObject = Record; /** * Checks whether the object has no own enumerable keys. * * @param obj - Object to check. * @returns `true` if the object has zero keys. * * @dbxUtil * @dbxUtilCategory object * @dbxUtilTags object, empty, keys, check, type-guard * @dbxUtilRelated object-has-key, object-has-keys, has-value-or-not-empty-object */ export declare function objectHasNoKeys(obj: object): obj is EmptyObject; /** * Checks whether the object has the specified own property using `Object.prototype.hasOwnProperty`. * * @dbxUtil * @dbxUtilCategory object * @dbxUtilTags object, key, has, own-property, check * @dbxUtilRelated object-has-keys, object-has-no-keys * * @param obj - Object to check * @param key - Property key to test for * @returns `true` if the object has the key as an own property */ export declare function objectHasKey(obj: T, key: KeyAsString): boolean; export declare function objectHasKey(obj: unknown, key: string): boolean; export declare function objectHasKey(obj: T, key: K): boolean; /** * Checks whether the object has all or any of the specified keys, based on the mode. * * @dbxUtil * @dbxUtilCategory object * @dbxUtilTags object, keys, has, check, all, any * @dbxUtilRelated object-has-key, object-has-no-keys * * @param obj - Object to check * @param keys - Keys to test for * @param mode - Whether to require 'all' keys or just 'any'; defaults to 'all' * @returns `true` if the keys match the mode criteria */ export declare function objectHasKeys(obj: T, keys: KeyAsString[], mode?: SetIncludesMode): boolean; export declare function objectHasKeys(obj: unknown, keys: ObjectKey[], mode?: SetIncludesMode): boolean; export declare function objectHasKeys(obj: T, keys: K[], mode?: SetIncludesMode): boolean; /** * Creates a partial object with the same value assigned to each of the specified fields. * * @param value - The value to assign to each field. * @param fields - Array of field names to set. * @returns A partial object with the value set on each specified field. */ export declare function applyToMultipleFields(value: X, fields: FieldOfType[]): Partial<{ [K in keyof T]: X; }>; /** * Converts a Map to a plain object by iterating entries and assigning key-value pairs. * * @param map - Map to convert. * @returns A plain object with the same key-value pairs. * * @dbxUtil * @dbxUtilCategory object * @dbxUtilTags object, map, convert, transform, dictionary */ export declare function mapToObject(map: Map): { [key: PropertyKey]: T; }; /** * Checks whether the value is a "plain" object, meaning an object literal or an object created with a * null prototype. * * Arrays, `Date`, `RegExp`, `Map`, `Set`, and class instances are NOT plain objects. This is the check * to use before recursing into a value's keys: a class instance's keys are an implementation detail and * copying them key-by-key produces a lifeless imitation of the original (a `Date` becomes `{}`). * * @param value - The value to check. * @returns `true` if the value is an object literal or has a null prototype. * * @dbxUtil * @dbxUtilCategory object * @dbxUtilTags object, pojo, plain, literal, type-guard, check * @dbxUtilRelated object-has-no-keys, copy-value-deep */ export declare function isPlainObject(value: unknown): value is Record; /** * Returns a copy of the input object. */ export type CopyObjectFunction = (input: T) => T; /** * Creates a shallow copy of an object using the spread operator. * * @param input - Object to copy. * @returns A new object with the same properties. * * @dbxUtil * @dbxUtilCategory object * @dbxUtilTags object, copy, clone, shallow, spread * @dbxUtilRelated copy-array */ export declare function copyObject(input: T): T;