/** * mapTree is like Array.prototype.map but for objects * applies mapping function deeply * mapping function allows to change object greatly, so be careful * * @param input {object} * @param fn {function} ({ key: string, value: any, parent: object, path: string }) => any * @returns {object} * @example * * const mapped = mapTree({ * a: 1, * b: { * c: 2 * } * }, ({ key, value }) => { * if (key === 'b') { * return { batman: { ...value, c: value.c * 2 } } * } * }) * * console.log(mapped) // <= * { * a: 1, * batman: { * c: 4 * } * } */ export declare const mapTree: (input: object, fn?: (a: { key: string; value: unknown; parent: object; path: string; }) => unknown, path?: string) => object;