UNPKG

jsout

Version:

A Syslog-compatible, small, and simple logger for Typescript/Javascript projects. Sponsored by https://aeroview.io

16 lines (15 loc) 850 B
/** * Recursively extracts and serializes custom enumerable properties from an object. * * - Handles deeply nested structures with a configurable depth limit. * - Prevents circular references using a WeakSet. * - Skips functions and replaces unserializable values with a placeholder. * - Only serializes own, enumerable properties (e.g. custom fields on Error objects). * * @param obj - The object to extract custom properties from. * @param currentDepth - The current recursion depth (default: 0). * @param maxDepth - Maximum allowed depth (default: 7). * @param seen - Tracks previously visited objects to prevent cycles. * @returns A safe, shallow object with extracted properties, or a placeholder string. */ export declare function serializeCustomProps(obj: any, currentDepth?: number, maxDepth?: number, seen?: WeakSet<any>): any;