lodash-walk-object
Version:
Walk all properties deep in object with lodash help
73 lines (72 loc) • 2.13 kB
TypeScript
export interface Circ {
/**
* Path whose value points to an already visited object.
*/
pathToObj: string;
/**
* Lodash path of the original object.
*/
circuralTargetPath: string | unknown;
}
export interface Models__NS__InDBType {
target: object;
path: string;
}
export interface Models__NS__Ver {
v: unknown;
p: string;
parent?: Models__NS__Ver;
isGetter?: boolean;
/**
* Active ancestor chain used by breadth-first traversal when
* shared objects should not be treated as circular.
*/
ancestors?: Models__NS__InDBType[];
}
export interface Models__NS__StartIteratorOptions {
walkGetters?: boolean;
/**
* When false, every repeated object reference is treated as circular.
*
* When true, only references to objects in the current ancestor chain
* are treated as circular. Shared objects are walked for every path.
*
* @default false
*/
considerSharedObjects?: boolean;
/**
* Circular checking is especially useful for breadth-first traversal.
*/
checkCircural?: boolean;
breadthWalk?: boolean;
include?: string[];
exclude?: string[];
}
export interface Models__NS__AdditionalIteratorOptions extends Models__NS__StartIteratorOptions {
skipObject?: () => void;
isGetter?: boolean;
/**
* Breadth walk skips the contents of circular objects.
*/
isCircural?: boolean;
exit?: () => void;
}
export interface Models__NS__InternalValues extends Models__NS__AdditionalIteratorOptions {
stack?: Models__NS__InDBType[];
circural?: Circ[];
hasIterator?: boolean;
_valueChanged: boolean;
_skip: boolean;
_exit: boolean;
}
export type Iterator = (value: unknown, lodashPath: string, changeValueTo: (newValue: unknown) => void, options?: Models__NS__AdditionalIteratorOptions) => void;
export type UnknownRecord = Record<PropertyKey, unknown>;
export interface PreparedPath {
contextPath: string;
property: string | number;
}
export interface PropertyEntry {
key: string;
value: unknown;
isGetter: boolean;
}