| 1 | type AssignCustomizer = (objectValue: any, sourceValue: any, key?: string, object?: {}, source?: {}) => any;
|
|---|
| 2 | /**
|
|---|
| 3 | * Assigns own properties from one source object to a target object using a customizer function.
|
|---|
| 4 | *
|
|---|
| 5 | * @template T - The type of the target object.
|
|---|
| 6 | * @template U - The type of the source object.
|
|---|
| 7 | * @param {T} object - The target object to which properties will be assigned.
|
|---|
| 8 | * @param {U} source - The source object whose properties will be assigned to the target object.
|
|---|
| 9 | * @param {AssignCustomizer} customizer - The function to customize assigned values.
|
|---|
| 10 | * @returns {T & U} The updated target object with properties from the source object assigned.
|
|---|
| 11 | *
|
|---|
| 12 | * @example
|
|---|
| 13 | * const target = { a: 1, b: 2 };
|
|---|
| 14 | * const source = { b: 3, c: 4 };
|
|---|
| 15 | * const result = assignWith(target, source, (objValue, srcValue) => {
|
|---|
| 16 | * return objValue === undefined ? srcValue : objValue;
|
|---|
| 17 | * });
|
|---|
| 18 | * // => { a: 1, b: 2, c: 4 }
|
|---|
| 19 | */
|
|---|
| 20 | declare function assignWith<T, U>(object: T, source: U, customizer: AssignCustomizer): T & U;
|
|---|
| 21 | /**
|
|---|
| 22 | * Assigns own properties from two source objects to a target object using a customizer function.
|
|---|
| 23 | *
|
|---|
| 24 | * @template T - The type of the target object.
|
|---|
| 25 | * @template U - The type of the first source object.
|
|---|
| 26 | * @template V - The type of the second source object.
|
|---|
| 27 | * @param {T} object - The target object to which properties will be assigned.
|
|---|
| 28 | * @param {U} source1 - The first source object whose properties will be assigned to the target object.
|
|---|
| 29 | * @param {V} source2 - The second source object whose properties will be assigned to the target object.
|
|---|
| 30 | * @param {AssignCustomizer} customizer - The function to customize assigned values.
|
|---|
| 31 | * @returns {T & U & V} The updated target object with properties from the source objects assigned.
|
|---|
| 32 | *
|
|---|
| 33 | * @example
|
|---|
| 34 | * const target = { a: 1 };
|
|---|
| 35 | * const source1 = { b: 2 };
|
|---|
| 36 | * const source2 = { c: 3 };
|
|---|
| 37 | * const result = assignWith(target, source1, source2, (objValue, srcValue) => {
|
|---|
| 38 | * return objValue === undefined ? srcValue : objValue;
|
|---|
| 39 | * });
|
|---|
| 40 | * // => { a: 1, b: 2, c: 3 }
|
|---|
| 41 | */
|
|---|
| 42 | declare function assignWith<T, U, V>(object: T, source1: U, source2: V, customizer: AssignCustomizer): T & U & V;
|
|---|
| 43 | /**
|
|---|
| 44 | * Assigns own properties from three source objects to a target object using a customizer function.
|
|---|
| 45 | *
|
|---|
| 46 | * @template T - The type of the target object.
|
|---|
| 47 | * @template U - The type of the first source object.
|
|---|
| 48 | * @template V - The type of the second source object.
|
|---|
| 49 | * @template W - The type of the third source object.
|
|---|
| 50 | * @param {T} object - The target object to which properties will be assigned.
|
|---|
| 51 | * @param {U} source1 - The first source object whose properties will be assigned to the target object.
|
|---|
| 52 | * @param {V} source2 - The second source object whose properties will be assigned to the target object.
|
|---|
| 53 | * @param {W} source3 - The third source object whose properties will be assigned to the target object.
|
|---|
| 54 | * @param {AssignCustomizer} customizer - The function to customize assigned values.
|
|---|
| 55 | * @returns {T & U & V & W} The updated target object with properties from the source objects assigned.
|
|---|
| 56 | *
|
|---|
| 57 | * @example
|
|---|
| 58 | * const target = { a: 1 };
|
|---|
| 59 | * const source1 = { b: 2 };
|
|---|
| 60 | * const source2 = { c: 3 };
|
|---|
| 61 | * const source3 = { d: 4 };
|
|---|
| 62 | * const result = assignWith(target, source1, source2, source3, (objValue, srcValue) => {
|
|---|
| 63 | * return objValue === undefined ? srcValue : objValue;
|
|---|
| 64 | * });
|
|---|
| 65 | * // => { a: 1, b: 2, c: 3, d: 4 }
|
|---|
| 66 | */
|
|---|
| 67 | declare function assignWith<T, U, V, W>(object: T, source1: U, source2: V, source3: W, customizer: AssignCustomizer): T & U & V & W;
|
|---|
| 68 | /**
|
|---|
| 69 | * Assigns own properties from four source objects to a target object using a customizer function.
|
|---|
| 70 | *
|
|---|
| 71 | * @template T - The type of the target object.
|
|---|
| 72 | * @template U - The type of the first source object.
|
|---|
| 73 | * @template V - The type of the second source object.
|
|---|
| 74 | * @template W - The type of the third source object.
|
|---|
| 75 | * @template X - The type of the fourth source object.
|
|---|
| 76 | * @param {T} object - The target object to which properties will be assigned.
|
|---|
| 77 | * @param {U} source1 - The first source object whose properties will be assigned to the target object.
|
|---|
| 78 | * @param {V} source2 - The second source object whose properties will be assigned to the target object.
|
|---|
| 79 | * @param {W} source3 - The third source object whose properties will be assigned to the target object.
|
|---|
| 80 | * @param {X} source4 - The fourth source object whose properties will be assigned to the target object.
|
|---|
| 81 | * @param {AssignCustomizer} customizer - The function to customize assigned values.
|
|---|
| 82 | * @returns {T & U & V & W & X} The updated target object with properties from the source objects assigned.
|
|---|
| 83 | *
|
|---|
| 84 | * @example
|
|---|
| 85 | * const target = { a: 1 };
|
|---|
| 86 | * const source1 = { b: 2 };
|
|---|
| 87 | * const source2 = { c: 3 };
|
|---|
| 88 | * const source3 = { d: 4 };
|
|---|
| 89 | * const source4 = { e: 5 };
|
|---|
| 90 | * const result = assignWith(target, source1, source2, source3, source4, (objValue, srcValue) => {
|
|---|
| 91 | * return objValue === undefined ? srcValue : objValue;
|
|---|
| 92 | * });
|
|---|
| 93 | * // => { a: 1, b: 2, c: 3, d: 4, e: 5 }
|
|---|
| 94 | */
|
|---|
| 95 | declare function assignWith<T, U, V, W, X>(object: T, source1: U, source2: V, source3: W, source4: X, customizer: AssignCustomizer): T & U & V & W & X;
|
|---|
| 96 | /**
|
|---|
| 97 | * Returns the target object as-is.
|
|---|
| 98 | *
|
|---|
| 99 | * @template T - The type of the target object.
|
|---|
| 100 | * @param {T} object - The target object.
|
|---|
| 101 | * @returns {T} The target object.
|
|---|
| 102 | *
|
|---|
| 103 | * @example
|
|---|
| 104 | * const target = { a: 1, b: 2 };
|
|---|
| 105 | * const result = assignWith(target);
|
|---|
| 106 | * // => { a: 1, b: 2 }
|
|---|
| 107 | */
|
|---|
| 108 | declare function assignWith<T>(object: T): T;
|
|---|
| 109 | /**
|
|---|
| 110 | * Assigns own properties from multiple source objects to a target object using a customizer function.
|
|---|
| 111 | *
|
|---|
| 112 | * @template R - The type of the result.
|
|---|
| 113 | * @param {any} object - The target object to which properties will be assigned.
|
|---|
| 114 | * @param {...any[]} otherArgs - The source objects and customizer function.
|
|---|
| 115 | * @returns {R} The updated target object with properties from the source objects assigned.
|
|---|
| 116 | *
|
|---|
| 117 | * @example
|
|---|
| 118 | * const target = { a: 1 };
|
|---|
| 119 | * const result = assignWith(target, { b: 2 }, { c: 3 }, (objValue, srcValue) => {
|
|---|
| 120 | * return objValue === undefined ? srcValue : objValue;
|
|---|
| 121 | * });
|
|---|
| 122 | * // => { a: 1, b: 2, c: 3 }
|
|---|
| 123 | */
|
|---|
| 124 | declare function assignWith<R>(object: any, ...otherArgs: any[]): R;
|
|---|
| 125 |
|
|---|
| 126 | export { assignWith };
|
|---|