import type { Dictionary } from '../types/utils'; /** * Iterates over every non-undefined property of the object calling the callback passed as * parameter. * * @param obj - The object to iterate through each property. * @param callbackFn - The callback function to call for each property. */ export declare function forEach(obj: T | undefined | null, callbackFn: (key: keyof T, value: Exclude, index: number) => void): void; /** * Iterates through the obj properties calling the reducer function. * * @param obj - The object to iterate through each property. * @param reducer - A function that will be called for each property, modifying the initialValue * object. * @param initialValue - The initial value of the accumulator property of the reducer function. * @returns Result of the reducer function. */ export declare function reduce(obj: T | undefined | null, reducer: (accumulator: V, key: keyof T, value: Exclude, index: number) => V, initialValue: V): V; /** * Creates an object from another object transforming each property value. * * @param obj - The object to transform each property value. * @param mapper - The mapper function which will transform each value. * @returns A record with the result of the mapper. */ export declare function map(obj: T | undefined | null, mapper: (key: keyof T, value: Exclude, index: number) => W): Record; /** * Creates an object picking only the not undefined properties. * * @param obj - The object from whom pick the values. * @returns A new object with the not undefined properties of the source object. */ export declare function cleanUndefined(obj: T): T; /** * Creates an object picking only the properties whose values are not: * - `undefined`. * - `null`. * - an empty string. * - an empty array. * - an empty object. * * @param obj - The object from whom pick the values. * @returns A new object with the not empty properties of the source object. */ export declare function cleanEmpty>(obj: SomeObject): SomeObject; /** * Creates an object picking only the ones that pass the test implemented by the * provided function isIncluded. * * @param obj - T object to be filtered. * @param isIncluded - Test function that every obj item must pass. * @returns A filtered object. */ export declare function objectFilter(obj: T | undefined | null, isIncluded: (key: keyof T, value: Exclude, index: number) => boolean): T; /** * Compares two objects of the same type, checking the values of their keys and retrieving * those that were not present in the old value and/or those whose value has changed. * * @param newValue - The new object value. * @param oldValue - The old object value. * @returns An array of keys. */ export declare function getNewAndUpdatedKeys(newValue: ObjectType | undefined, oldValue: ObjectType | undefined): (keyof ObjectType)[]; /** * Ensures that the given condition is met in all the non-undefined entries of the object. * * @param object - The object to check if every item meets the given condition. * @param condition - The condition to check in each one of the entries of the object. * @returns True when all the entries pass the condition. False otherwise. */ export declare function every(object: ObjectType, condition: (key: keyof ObjectType, value: Exclude, index: number) => boolean): boolean; /** * Flattens recursively the passed object to a one level object. * * @param object - The object to flatten. * @returns The flattened object. */ export declare function flatObject(object: Dictionary): Dictionary; /** * Renames the keys of an object adding a prefix, a suffix, or both. * * @param object - The object to rename its keys. * @param pattern - The options to rename with: a prefix and a suffix. * @returns A new object with the keys renamed following the pattern. */ export declare function rename(object: SomeObject, { prefix, suffix }: RenameOptions): Rename; /** * Renames the keys of the given object prefixing and suffixing them. */ export type Rename = { [Key in keyof SomeObject as `${Prefix}${Key & string}${Suffix}`]: SomeObject[Key]; }; /** * An optional prefix and suffix. */ interface RenameOptions { prefix?: Prefix; suffix?: Suffix; } /** * Checks if two objects are deeply equal. * * @param object1 - First object to compare. * @param object2 - Second object to compare. * @returns True if both objects are deeply equal. False otherwise. */ export declare function deepEqual(object1: ObjectType | undefined, object2: ObjectType | undefined): boolean; export {};