lodash-walk-object
Version:
Walk all properties deep in object with lodash help
80 lines (79 loc) • 2.34 kB
TypeScript
// @ts-nocheck
interface Circ {
/**
* This path value will be overriten with circural object value
*/
pathToObj: string;
/**
* lodash path to circural objects
* OR
* actual object for circural mapping
*/
circuralTargetPath: string | any;
}
declare namespace Models {
interface InDBType {
target: any;
path: string;
}
interface Ver {
v: any;
p: string;
parent: Ver;
isGetter?: boolean;
}
interface StartIteratorOptions {
walkGetters?: boolean;
/**
* Default in breadhTwalk
*/
checkCircural?: boolean;
breadthWalk?: boolean;
include?: string[];
exclude?: string[];
}
interface AdditionalIteratorOptions extends StartIteratorOptions {
skipObject?: () => void;
isGetter?: boolean;
/**
* Breadth walk will skip content of circural objects
*/
isCircural?: boolean;
exit?: () => void;
}
interface InternalValues extends AdditionalIteratorOptions {
stack?: any[];
circural?: Circ[];
hasIterator?: boolean;
_valueChanged: boolean;
_skip: boolean;
_exit: boolean;
}
}
type Iterator = (value: any, lodashPath: string, changeValueTo: (newValue: any) => void, options?: Models.AdditionalIteratorOptions) => void;
declare class Helpers {
static get Walk(): {
Object(json: Object, iterator: Iterator, optionsOrWalkGettersValue?: Models.StartIteratorOptions): {
circs: Circ[];
};
ObjectBy(property: string, inContext: Object, iterator: Iterator, options?: Models.StartIteratorOptions): {
circs: Circ[];
};
};
private static _changeValue;
private static _prepareParams;
private static get _Helpers();
private static _shoudlReturn;
private static prepareOptions;
private static _walk;
}
declare const walk: {
Object: (json: Object, iterator: Iterator, optionsOrWalkGettersValue?: Models.StartIteratorOptions) => {
circs: Circ[];
};
ObjectBy: (property: string, inContext: Object, iterator: Iterator, options?: Models.StartIteratorOptions) => {
circs: Circ[];
};
};
export { Helpers, Models, walk };
export type { Circ, Iterator };