UNPKG

diginext-utils

Version:
20 lines 769 B
/** * Recursively iterates through all keys and values of an object and its nested objects. * Calls the callback function for each key-value pair. * * @template T - The type of the object * @param obj - The object to iterate through * @param callback - Function to call for each key-value pair * @returns The original object (potentially modified by callback) * * @example * ```ts * const obj = { a: 1, b: { c: 2, d: 3 } }; * iterate(obj, (obj, key, value) => { * console.log(key, value); * }); * // Logs: 'a' 1, 'b' { c: 2, d: 3 }, 'c' 2, 'd' 3 * ``` */ export declare function iterate<T extends Record<string, unknown>>(obj: T, callback: (obj: Record<string, unknown>, key: string, value: unknown) => void): T; //# sourceMappingURL=iterate.d.ts.map