UNPKG

@dyihoon90/glogging

Version:

HTTP request logging middleware & transaction function decorator for express, using winston

30 lines (29 loc) 1.52 kB
/** * Traverse the object deeply, calling callback on all properties that are not object * Arrays and objects are both considered object * Removes circular references * Limits the traversal depth to prevent excessive recursion * Note: Mutates the obj passed in * @param obj The object to traverse and mutate * @param callback Function to call on each non-object property * @param maxDepth Maximum depth to traverse (default: 100) * @param currentDepth Current depth of traversal (used internally) * @param seen Set of already seen objects (used for circular reference detection) * @returns The mutated object */ export declare function traverseAndMutateObject(obj: Record<string | symbol, unknown>, callback: (key: string, value: unknown) => unknown, maxDepth?: number, currentDepth?: number, seen?: Set<unknown>): unknown; /** * Remove from obj, all properties list redactedProperties. * Recursively remove from nested properties as well * @param redactedProperties * @param clonedObj */ export declare function redactProperties<T extends Record<string | number | symbol, any>>(redactedProperties: Array<string | number | symbol>, obj: T): T; /** * Checks if the given value is a plain object. * A plain object is an object created by the Object constructor or one with a [[Prototype]] of null. * * @param value - The value to check * @returns True if the value is a plain object, false otherwise */ export declare function isPlainObject(value: unknown): value is Record<string | symbol, unknown>;