import './types.js'; import { ObjectIteratorOptions } from './object/objectIterator.js'; import './consts.js'; import { Collection } from './types/collection.js'; /** * 深度遍历对象成员,当值满足条件时,调用updater函数的返回值来更新值 * let data ={a:1,b:2,l:[1,2,3],c:"xx"} * forEachUpdateObject(data,({value,parent,keyOrIndex})=>{ * return typeof(value)=="string" * },({value,parent,keyOrIndex})=>{ * return value.toUpperCase * }) * * @param {*} obj * @param {*} updater(value,parent,keyOrIndex) 返回值用来替换目标值 * @param {*} filter(value,parent,keyOrIndex) 可选的过滤函数,只有返回值=true的项才会进行更新 * 当指定该函数时,会在调用updater时先调用此函数,如果返回true则更新,否则不更新 * @returns */ type IForEachCallback = ({ value, parent, keyOrIndex }: { value?: any; parent?: Collection | null; keyOrIndex?: string | symbol | number | null; }) => any; declare function forEachUpdateObject(obj: any[] | object, filter: IForEachCallback, updater: IForEachCallback, options?: ForEachObjectOptions): T; /** * * 深度遍历对象成员 * * 遍历过程中可以通过在在callback中返回ABORT来中止遍历 */ type ForEachObjectOptions = ObjectIteratorOptions; declare function forEachObject(obj: Collection, callback: IForEachCallback, options?: ForEachObjectOptions): void; export { type ForEachObjectOptions as F, type IForEachCallback as I, forEachUpdateObject as a, forEachObject as f };