UNPKG

2.63 kBTypeScriptView Raw
1import { Memo } from './memo';
2/**
3 * Replace a method in an object with a wrapped version of itself.
4 *
5 * @param source An object that contains a method to be wrapped.
6 * @param name The name of the method to be wrapped.
7 * @param replacementFactory A higher-order function that takes the original version of the given method and returns a
8 * wrapped version. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to
9 * preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, <other
10 * args>)` or `origMethod.apply(this, [<other args>])` (rather than being called directly), again to preserve `this`.
11 * @returns void
12 */
13export declare function fill(source: {
14 [key: string]: any;
15}, name: string, replacementFactory: (...args: any[]) => any): void;
16/**
17 * Encodes given object into url-friendly format
18 *
19 * @param object An object that contains serializable values
20 * @returns string Encoded
21 */
22export declare function urlEncode(object: {
23 [key: string]: any;
24}): string;
25/** JSDoc */
26export declare function normalizeToSize<T>(object: {
27 [key: string]: any;
28}, depth?: number, maxSize?: number): T;
29/**
30 * Walks an object to perform a normalization on it
31 *
32 * @param key of object that's walked in current iteration
33 * @param value object to be walked
34 * @param depth Optional number indicating how deep should walking be performed
35 * @param memo Optional Memo class handling decycling
36 */
37export declare function walk(key: string, value: any, depth?: number, memo?: Memo): any;
38/**
39 * normalize()
40 *
41 * - Creates a copy to prevent original input mutation
42 * - Skip non-enumerablers
43 * - Calls `toJSON` if implemented
44 * - Removes circular references
45 * - Translates non-serializeable values (undefined/NaN/Functions) to serializable format
46 * - Translates known global objects/Classes to a string representations
47 * - Takes care of Error objects serialization
48 * - Optionally limit depth of final output
49 */
50export declare function normalize(input: any, depth?: number): any;
51/**
52 * Given any captured exception, extract its keys and create a sorted
53 * and truncated list that will be used inside the event message.
54 * eg. `Non-error exception captured with keys: foo, bar, baz`
55 */
56export declare function extractExceptionKeysForMessage(exception: any, maxLength?: number): string;
57/**
58 * Given any object, return the new object with removed keys that value was `undefined`.
59 * Works recursively on objects and arrays.
60 */
61export declare function dropUndefinedKeys<T>(val: T): T;
62//# sourceMappingURL=object.d.ts.map
\No newline at end of file