1 | import { Primitive } from '@sentry/types';
|
2 | import { MemoFunc } from './memo';
|
3 | declare type ObjOrArray<T> = {
|
4 | [key: string]: T;
|
5 | };
|
6 | /**
|
7 | * Recursively normalizes the given object.
|
8 | *
|
9 | * - Creates a copy to prevent original input mutation
|
10 | * - Skips non-enumerable properties
|
11 | * - When stringifying, calls `toJSON` if implemented
|
12 | * - Removes circular references
|
13 | * - Translates non-serializable values (`undefined`/`NaN`/functions) to serializable format
|
14 | * - Translates known global objects/classes to a string representations
|
15 | * - Takes care of `Error` object serialization
|
16 | * - Optionally limits depth of final output
|
17 | * - Optionally limits number of properties/elements included in any single object/array
|
18 | *
|
19 | * @param input The object to be normalized.
|
20 | * @param depth The max depth to which to normalize the object. (Anything deeper stringified whole.)
|
21 | * @param maxProperties The max number of elements or properties to be included in any single array or
|
22 | * object in the normallized output..
|
23 | * @returns A normalized version of the object, or `"**non-serializable**"` if any errors are thrown during normalization.
|
24 | */
|
25 | export declare function normalize(input: unknown, depth?: number, maxProperties?: number): any;
|
26 | /** JSDoc */
|
27 | export declare function normalizeToSize<T>(object: {
|
28 | [key: string]: any;
|
29 | }, depth?: number, maxSize?: number): T;
|
30 | /**
|
31 | * Visits a node to perform normalization on it
|
32 | *
|
33 | * @param key The key corresponding to the given node
|
34 | * @param value The node to be visited
|
35 | * @param depth Optional number indicating the maximum recursion depth
|
36 | * @param maxProperties Optional maximum number of properties/elements included in any single object/array
|
37 | * @param memo Optional Memo class handling decycling
|
38 | */
|
39 | declare function visit(key: string, value: unknown, depth?: number, maxProperties?: number, memo?: MemoFunc): Primitive | ObjOrArray<unknown>;
|
40 | export { visit as walk };
|
41 | //# sourceMappingURL=normalize.d.ts.map |
\ | No newline at end of file |