UNPKG

2.12 kBTypeScriptView Raw
1/**
2 * Helper class to perform property introspection and dynamic writing.
3 *
4 * It is similar to [[ObjectWriter]] but writes properties recursively
5 * through the entire object graph. Nested property names are defined
6 * using dot notation as "object.subobject.property"
7 *
8 * @see [[PropertyReflector]]
9 * @see [[ObjectWriter]]
10 */
11export declare class RecursiveObjectWriter {
12 private static createProperty;
13 private static performSetProperty;
14 /**
15 * Recursively sets value of object and its subobjects property specified by its name.
16 *
17 * The object can be a user defined object, map or array.
18 * The property name correspondently must be object property,
19 * map key or array index.
20 *
21 * If the property does not exist or introspection fails
22 * this method doesn't do anything and doesn't any throw errors.
23 *
24 * @param obj an object to write property to.
25 * @param name a name of the property to set.
26 * @param value a new value for the property to set.
27 */
28 static setProperty(obj: any, name: string, value: any): void;
29 /**
30 * Recursively sets values of some (all) object and its subobjects properties.
31 *
32 * The object can be a user defined object, map or array.
33 * Property values correspondently are object properties,
34 * map key-pairs or array elements with their indexes.
35 *
36 * If some properties do not exist or introspection fails
37 * they are just silently skipped and no errors thrown.
38 *
39 * @param obj an object to write properties to.
40 * @param values a map, containing property names and their values.
41 *
42 * @see [[setProperty]]
43 */
44 static setProperties(obj: any, values: any): void;
45 /**
46 * Copies content of one object to another object
47 * by recursively reading all properties from source object
48 * and then recursively writing them to destination object.
49 *
50 * @param dest a destination object to write properties to.
51 * @param src a source object to read properties from
52 */
53 static copyProperties(dest: any, src: any): void;
54}