@gx-design-vue/pro-utils 0.2.0-beta.46 → 0.2.0-beta.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Creates a deep clone of the given object.
3
+ *
4
+ * @template T - The type of the object.
5
+ * @param {T} obj - The object to clone.
6
+ * @returns {T} - A deep clone of the given object.
7
+ *
8
+ * @example
9
+ * // Clone a primitive values
10
+ * const num = 29;
11
+ * const clonedNum = clone(num);
12
+ * console.log(clonedNum); // 29
13
+ * console.log(clonedNum === num) ; // true
14
+ *
15
+ * @example
16
+ * // Clone an array
17
+ * const arr = [1, 2, 3];
18
+ * const clonedArr = clone(arr);
19
+ * console.log(clonedArr); // [1, 2, 3]
20
+ * console.log(clonedArr === arr); // false
21
+ *
22
+ * @example
23
+ * // Clone an array with nested objects
24
+ * const arr = [1, { a: 1 }, [1, 2, 3]];
25
+ * const clonedArr = clone(arr);
26
+ * arr[1].a = 2;
27
+ * console.log(arr); // [2, { a: 2 }, [1, 2, 3]]
28
+ * console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]
29
+ * console.log(clonedArr === arr); // false
30
+ *
31
+ * @example
32
+ * // Clone an object
33
+ * const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };
34
+ * const clonedObj = clone(obj);
35
+ * console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }
36
+ * console.log(clonedObj === obj); // false
37
+ *
38
+ * @example
39
+ * // Clone an object with nested objects
40
+ * const obj = { a: 1, b: { c: 1 } };
41
+ * const clonedObj = clone(obj);
42
+ * obj.b.c = 2;
43
+ * console.log(obj); // { a: 1, b: { c: 2 } }
44
+ * console.log(clonedObj); // { a: 1, b: { c: 1 } }
45
+ * console.log(clonedObj === obj); // false
46
+ */
47
+ export declare function cloneDeep<T>(obj: T): T;
48
+ export declare function copyProperties(target: any, source: any, stack?: Map<any, any>): void;
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import scrollTo from './scroll/scrollTo';
11
11
  import getScroll from './scroll/getScroll';
12
12
  import throttleByAnimationFrame from './scroll/throttleByAnimationFrame';
13
13
  import globalConfig from './utils/config';
14
+ export * from './cloneDeep';
14
15
  export * from './isDeepEqualReact';
15
16
  export * from './isBrowser';
16
17
  export * from './omitBoolean';