@genesislcap/foundation-utils 14.371.0-FUI-2456.1 → 14.371.0
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.
- package/dist/custom-elements.json +91 -142
- package/dist/dts/utils/index.d.ts +0 -1
- package/dist/dts/utils/index.d.ts.map +1 -1
- package/dist/esm/utils/index.js +0 -1
- package/dist/foundation-utils.api.json +0 -88
- package/dist/foundation-utils.d.ts +0 -18
- package/docs/api/foundation-utils.md +0 -11
- package/docs/api-report.md.api.md +0 -3
- package/package.json +11 -11
- package/dist/dts/utils/deepMerge.d.ts +0 -18
- package/dist/dts/utils/deepMerge.d.ts.map +0 -1
- package/dist/esm/utils/deepMerge.js +0 -48
- package/docs/api/foundation-utils.deepmerge.md +0 -82
|
@@ -383,97 +383,6 @@
|
|
|
383
383
|
}
|
|
384
384
|
]
|
|
385
385
|
},
|
|
386
|
-
{
|
|
387
|
-
"kind": "javascript-module",
|
|
388
|
-
"path": "src/decorators/index.ts",
|
|
389
|
-
"declarations": [],
|
|
390
|
-
"exports": [
|
|
391
|
-
{
|
|
392
|
-
"kind": "js",
|
|
393
|
-
"name": "*",
|
|
394
|
-
"declaration": {
|
|
395
|
-
"name": "*",
|
|
396
|
-
"package": "./renderOnChange"
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
]
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
"kind": "javascript-module",
|
|
403
|
-
"path": "src/decorators/renderOnChange.ts",
|
|
404
|
-
"declarations": [
|
|
405
|
-
{
|
|
406
|
-
"kind": "function",
|
|
407
|
-
"name": "renderOnChange",
|
|
408
|
-
"parameters": [
|
|
409
|
-
{
|
|
410
|
-
"name": "target",
|
|
411
|
-
"type": {
|
|
412
|
-
"text": "FASTElement & { render(): void }"
|
|
413
|
-
},
|
|
414
|
-
"description": "The target to define the property change handler on."
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
"name": "name",
|
|
418
|
-
"type": {
|
|
419
|
-
"text": "string"
|
|
420
|
-
},
|
|
421
|
-
"description": "The property name."
|
|
422
|
-
}
|
|
423
|
-
],
|
|
424
|
-
"description": "Defines a property changed handler that calls a render() method on the target as an internal observation enhancement.",
|
|
425
|
-
"privacy": "public"
|
|
426
|
-
}
|
|
427
|
-
],
|
|
428
|
-
"exports": [
|
|
429
|
-
{
|
|
430
|
-
"kind": "js",
|
|
431
|
-
"name": "renderOnChange",
|
|
432
|
-
"declaration": {
|
|
433
|
-
"name": "renderOnChange",
|
|
434
|
-
"module": "src/decorators/renderOnChange.ts"
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
]
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
"kind": "javascript-module",
|
|
441
|
-
"path": "src/directives/index.ts",
|
|
442
|
-
"declarations": [],
|
|
443
|
-
"exports": [
|
|
444
|
-
{
|
|
445
|
-
"kind": "js",
|
|
446
|
-
"name": "*",
|
|
447
|
-
"declaration": {
|
|
448
|
-
"name": "*",
|
|
449
|
-
"package": "./sync"
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
{
|
|
453
|
-
"kind": "js",
|
|
454
|
-
"name": "*",
|
|
455
|
-
"declaration": {
|
|
456
|
-
"name": "*",
|
|
457
|
-
"package": "./when-else"
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
]
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
"kind": "javascript-module",
|
|
464
|
-
"path": "src/encoding/index.ts",
|
|
465
|
-
"declarations": [],
|
|
466
|
-
"exports": [
|
|
467
|
-
{
|
|
468
|
-
"kind": "js",
|
|
469
|
-
"name": "*",
|
|
470
|
-
"declaration": {
|
|
471
|
-
"name": "*",
|
|
472
|
-
"package": "./base64"
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
]
|
|
476
|
-
},
|
|
477
386
|
{
|
|
478
387
|
"kind": "javascript-module",
|
|
479
388
|
"path": "src/design-system/design-system.ts",
|
|
@@ -594,6 +503,82 @@
|
|
|
594
503
|
}
|
|
595
504
|
]
|
|
596
505
|
},
|
|
506
|
+
{
|
|
507
|
+
"kind": "javascript-module",
|
|
508
|
+
"path": "src/decorators/index.ts",
|
|
509
|
+
"declarations": [],
|
|
510
|
+
"exports": [
|
|
511
|
+
{
|
|
512
|
+
"kind": "js",
|
|
513
|
+
"name": "*",
|
|
514
|
+
"declaration": {
|
|
515
|
+
"name": "*",
|
|
516
|
+
"package": "./renderOnChange"
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
]
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"kind": "javascript-module",
|
|
523
|
+
"path": "src/decorators/renderOnChange.ts",
|
|
524
|
+
"declarations": [
|
|
525
|
+
{
|
|
526
|
+
"kind": "function",
|
|
527
|
+
"name": "renderOnChange",
|
|
528
|
+
"parameters": [
|
|
529
|
+
{
|
|
530
|
+
"name": "target",
|
|
531
|
+
"type": {
|
|
532
|
+
"text": "FASTElement & { render(): void }"
|
|
533
|
+
},
|
|
534
|
+
"description": "The target to define the property change handler on."
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
"name": "name",
|
|
538
|
+
"type": {
|
|
539
|
+
"text": "string"
|
|
540
|
+
},
|
|
541
|
+
"description": "The property name."
|
|
542
|
+
}
|
|
543
|
+
],
|
|
544
|
+
"description": "Defines a property changed handler that calls a render() method on the target as an internal observation enhancement.",
|
|
545
|
+
"privacy": "public"
|
|
546
|
+
}
|
|
547
|
+
],
|
|
548
|
+
"exports": [
|
|
549
|
+
{
|
|
550
|
+
"kind": "js",
|
|
551
|
+
"name": "renderOnChange",
|
|
552
|
+
"declaration": {
|
|
553
|
+
"name": "renderOnChange",
|
|
554
|
+
"module": "src/decorators/renderOnChange.ts"
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
]
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
"kind": "javascript-module",
|
|
561
|
+
"path": "src/directives/index.ts",
|
|
562
|
+
"declarations": [],
|
|
563
|
+
"exports": [
|
|
564
|
+
{
|
|
565
|
+
"kind": "js",
|
|
566
|
+
"name": "*",
|
|
567
|
+
"declaration": {
|
|
568
|
+
"name": "*",
|
|
569
|
+
"package": "./sync"
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"kind": "js",
|
|
574
|
+
"name": "*",
|
|
575
|
+
"declaration": {
|
|
576
|
+
"name": "*",
|
|
577
|
+
"package": "./when-else"
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
]
|
|
581
|
+
},
|
|
597
582
|
{
|
|
598
583
|
"kind": "javascript-module",
|
|
599
584
|
"path": "src/env/index.ts",
|
|
@@ -1268,6 +1253,21 @@
|
|
|
1268
1253
|
}
|
|
1269
1254
|
]
|
|
1270
1255
|
},
|
|
1256
|
+
{
|
|
1257
|
+
"kind": "javascript-module",
|
|
1258
|
+
"path": "src/encoding/index.ts",
|
|
1259
|
+
"declarations": [],
|
|
1260
|
+
"exports": [
|
|
1261
|
+
{
|
|
1262
|
+
"kind": "js",
|
|
1263
|
+
"name": "*",
|
|
1264
|
+
"declaration": {
|
|
1265
|
+
"name": "*",
|
|
1266
|
+
"package": "./base64"
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
]
|
|
1270
|
+
},
|
|
1271
1271
|
{
|
|
1272
1272
|
"kind": "javascript-module",
|
|
1273
1273
|
"path": "src/formatters/datetime.ts",
|
|
@@ -3489,49 +3489,6 @@
|
|
|
3489
3489
|
}
|
|
3490
3490
|
]
|
|
3491
3491
|
},
|
|
3492
|
-
{
|
|
3493
|
-
"kind": "javascript-module",
|
|
3494
|
-
"path": "src/utils/deepMerge.ts",
|
|
3495
|
-
"declarations": [
|
|
3496
|
-
{
|
|
3497
|
-
"kind": "function",
|
|
3498
|
-
"name": "deepMerge",
|
|
3499
|
-
"return": {
|
|
3500
|
-
"type": {
|
|
3501
|
-
"text": ""
|
|
3502
|
-
}
|
|
3503
|
-
},
|
|
3504
|
-
"parameters": [
|
|
3505
|
-
{
|
|
3506
|
-
"name": "target",
|
|
3507
|
-
"type": {
|
|
3508
|
-
"text": "T"
|
|
3509
|
-
},
|
|
3510
|
-
"description": "The target object to merge into (defaults/base values)"
|
|
3511
|
-
},
|
|
3512
|
-
{
|
|
3513
|
-
"name": "source",
|
|
3514
|
-
"type": {
|
|
3515
|
-
"text": "Partial<T>"
|
|
3516
|
-
},
|
|
3517
|
-
"description": "The source object to merge from (overrides)"
|
|
3518
|
-
}
|
|
3519
|
-
],
|
|
3520
|
-
"description": "Deep merges two objects, with source values taking precedence over target values.\nArrays are replaced (not merged), and null/undefined values in source are preserved.",
|
|
3521
|
-
"privacy": "public"
|
|
3522
|
-
}
|
|
3523
|
-
],
|
|
3524
|
-
"exports": [
|
|
3525
|
-
{
|
|
3526
|
-
"kind": "js",
|
|
3527
|
-
"name": "deepMerge",
|
|
3528
|
-
"declaration": {
|
|
3529
|
-
"name": "deepMerge",
|
|
3530
|
-
"module": "src/utils/deepMerge.ts"
|
|
3531
|
-
}
|
|
3532
|
-
}
|
|
3533
|
-
]
|
|
3534
|
-
},
|
|
3535
3492
|
{
|
|
3536
3493
|
"kind": "javascript-module",
|
|
3537
3494
|
"path": "src/utils/delay.ts",
|
|
@@ -3666,14 +3623,6 @@
|
|
|
3666
3623
|
"path": "src/utils/index.ts",
|
|
3667
3624
|
"declarations": [],
|
|
3668
3625
|
"exports": [
|
|
3669
|
-
{
|
|
3670
|
-
"kind": "js",
|
|
3671
|
-
"name": "*",
|
|
3672
|
-
"declaration": {
|
|
3673
|
-
"name": "*",
|
|
3674
|
-
"package": "./deepMerge"
|
|
3675
|
-
}
|
|
3676
|
-
},
|
|
3677
3626
|
{
|
|
3678
3627
|
"kind": "js",
|
|
3679
3628
|
"name": "*",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1811,94 +1811,6 @@
|
|
|
1811
1811
|
],
|
|
1812
1812
|
"name": "decodeFromBase64WithPrefix"
|
|
1813
1813
|
},
|
|
1814
|
-
{
|
|
1815
|
-
"kind": "Function",
|
|
1816
|
-
"canonicalReference": "@genesislcap/foundation-utils!deepMerge:function(1)",
|
|
1817
|
-
"docComment": "/**\n * Deep merges two objects, with source values taking precedence over target values. Arrays are replaced (not merged), and null/undefined values in source are preserved.\n *\n * @param target - The target object to merge into (defaults/base values)\n *\n * @param source - The source object to merge from (overrides)\n *\n * @returns A new merged object with source values taking precedence\n *\n * @example\n * ```ts\n * const defaults = { a: 1, b: { c: 2, d: 3 } };\n * const overrides = { b: { c: 4 } };\n * const merged = deepMerge(defaults, overrides);\n * // Result: { a: 1, b: { c: 4, d: 3 } }\n * ```\n *\n * @public\n */\n",
|
|
1818
|
-
"excerptTokens": [
|
|
1819
|
-
{
|
|
1820
|
-
"kind": "Content",
|
|
1821
|
-
"text": "deepMerge: <T extends "
|
|
1822
|
-
},
|
|
1823
|
-
{
|
|
1824
|
-
"kind": "Reference",
|
|
1825
|
-
"text": "Record",
|
|
1826
|
-
"canonicalReference": "!Record:type"
|
|
1827
|
-
},
|
|
1828
|
-
{
|
|
1829
|
-
"kind": "Content",
|
|
1830
|
-
"text": "<string, any>"
|
|
1831
|
-
},
|
|
1832
|
-
{
|
|
1833
|
-
"kind": "Content",
|
|
1834
|
-
"text": ">(target: "
|
|
1835
|
-
},
|
|
1836
|
-
{
|
|
1837
|
-
"kind": "Content",
|
|
1838
|
-
"text": "T"
|
|
1839
|
-
},
|
|
1840
|
-
{
|
|
1841
|
-
"kind": "Content",
|
|
1842
|
-
"text": ", source: "
|
|
1843
|
-
},
|
|
1844
|
-
{
|
|
1845
|
-
"kind": "Reference",
|
|
1846
|
-
"text": "Partial",
|
|
1847
|
-
"canonicalReference": "!Partial:type"
|
|
1848
|
-
},
|
|
1849
|
-
{
|
|
1850
|
-
"kind": "Content",
|
|
1851
|
-
"text": "<T>"
|
|
1852
|
-
},
|
|
1853
|
-
{
|
|
1854
|
-
"kind": "Content",
|
|
1855
|
-
"text": ") => "
|
|
1856
|
-
},
|
|
1857
|
-
{
|
|
1858
|
-
"kind": "Content",
|
|
1859
|
-
"text": "T"
|
|
1860
|
-
}
|
|
1861
|
-
],
|
|
1862
|
-
"fileUrlPath": "src/utils/deepMerge.ts",
|
|
1863
|
-
"returnTypeTokenRange": {
|
|
1864
|
-
"startIndex": 9,
|
|
1865
|
-
"endIndex": 10
|
|
1866
|
-
},
|
|
1867
|
-
"releaseTag": "Public",
|
|
1868
|
-
"overloadIndex": 1,
|
|
1869
|
-
"parameters": [
|
|
1870
|
-
{
|
|
1871
|
-
"parameterName": "target",
|
|
1872
|
-
"parameterTypeTokenRange": {
|
|
1873
|
-
"startIndex": 4,
|
|
1874
|
-
"endIndex": 5
|
|
1875
|
-
},
|
|
1876
|
-
"isOptional": false
|
|
1877
|
-
},
|
|
1878
|
-
{
|
|
1879
|
-
"parameterName": "source",
|
|
1880
|
-
"parameterTypeTokenRange": {
|
|
1881
|
-
"startIndex": 6,
|
|
1882
|
-
"endIndex": 8
|
|
1883
|
-
},
|
|
1884
|
-
"isOptional": false
|
|
1885
|
-
}
|
|
1886
|
-
],
|
|
1887
|
-
"typeParameters": [
|
|
1888
|
-
{
|
|
1889
|
-
"typeParameterName": "T",
|
|
1890
|
-
"constraintTokenRange": {
|
|
1891
|
-
"startIndex": 1,
|
|
1892
|
-
"endIndex": 3
|
|
1893
|
-
},
|
|
1894
|
-
"defaultTypeTokenRange": {
|
|
1895
|
-
"startIndex": 0,
|
|
1896
|
-
"endIndex": 0
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
],
|
|
1900
|
-
"name": "deepMerge"
|
|
1901
|
-
},
|
|
1902
1814
|
{
|
|
1903
1815
|
"kind": "Variable",
|
|
1904
1816
|
"canonicalReference": "@genesislcap/foundation-utils!DEFAULT_ORGANISATION:var",
|
|
@@ -225,24 +225,6 @@ export declare const decodeFromBase64: (base64Value: string) => string | ArrayBu
|
|
|
225
225
|
*/
|
|
226
226
|
export declare const decodeFromBase64WithPrefix: (value: string) => string | ArrayBuffer;
|
|
227
227
|
|
|
228
|
-
/**
|
|
229
|
-
* Deep merges two objects, with source values taking precedence over target values.
|
|
230
|
-
* Arrays are replaced (not merged), and null/undefined values in source are preserved.
|
|
231
|
-
*
|
|
232
|
-
* @param target - The target object to merge into (defaults/base values)
|
|
233
|
-
* @param source - The source object to merge from (overrides)
|
|
234
|
-
* @returns A new merged object with source values taking precedence
|
|
235
|
-
* @public
|
|
236
|
-
* @example
|
|
237
|
-
* ```ts
|
|
238
|
-
* const defaults = { a: 1, b: { c: 2, d: 3 } };
|
|
239
|
-
* const overrides = { b: { c: 4 } };
|
|
240
|
-
* const merged = deepMerge(defaults, overrides);
|
|
241
|
-
* // Result: { a: 1, b: { c: 4, d: 3 } }
|
|
242
|
-
* ```
|
|
243
|
-
*/
|
|
244
|
-
export declare const deepMerge: <T extends Record<string, any>>(target: T, source: Partial<T>) => T;
|
|
245
|
-
|
|
246
228
|
/**
|
|
247
229
|
* The default Organisation value, used in auth/login flow [`genesislcap-foundation-login`](https://link-to-docs).
|
|
248
230
|
* @remarks Optional.
|
|
@@ -258,17 +258,6 @@ Decodes a value from base64.
|
|
|
258
258
|
Decodes a value from base64 with a prefix.
|
|
259
259
|
|
|
260
260
|
|
|
261
|
-
</td></tr>
|
|
262
|
-
<tr><td>
|
|
263
|
-
|
|
264
|
-
[deepMerge(target, source)](./foundation-utils.deepmerge.md)
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
</td><td>
|
|
268
|
-
|
|
269
|
-
Deep merges two objects, with source values taking precedence over target values. Arrays are replaced (not merged), and null/undefined values in source are preserved.
|
|
270
|
-
|
|
271
|
-
|
|
272
261
|
</td></tr>
|
|
273
262
|
<tr><td>
|
|
274
263
|
|
|
@@ -143,9 +143,6 @@ export const decodeFromBase64: (base64Value: string) => string | ArrayBuffer;
|
|
|
143
143
|
// @public
|
|
144
144
|
export const decodeFromBase64WithPrefix: (value: string) => string | ArrayBuffer;
|
|
145
145
|
|
|
146
|
-
// @public
|
|
147
|
-
export const deepMerge: <T extends Record<string, any>>(target: T, source: Partial<T>) => T;
|
|
148
|
-
|
|
149
146
|
// @public
|
|
150
147
|
export let DEFAULT_ORGANISATION: string;
|
|
151
148
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-utils",
|
|
3
3
|
"description": "Genesis Foundation Utils",
|
|
4
|
-
"version": "14.371.0
|
|
4
|
+
"version": "14.371.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@genesislcap/foundation-testing": "14.371.0
|
|
31
|
-
"@genesislcap/genx": "14.371.0
|
|
32
|
-
"@genesislcap/rollup-builder": "14.371.0
|
|
33
|
-
"@genesislcap/ts-builder": "14.371.0
|
|
34
|
-
"@genesislcap/uvu-playwright-builder": "14.371.0
|
|
35
|
-
"@genesislcap/vite-builder": "14.371.0
|
|
36
|
-
"@genesislcap/webpack-builder": "14.371.0
|
|
30
|
+
"@genesislcap/foundation-testing": "14.371.0",
|
|
31
|
+
"@genesislcap/genx": "14.371.0",
|
|
32
|
+
"@genesislcap/rollup-builder": "14.371.0",
|
|
33
|
+
"@genesislcap/ts-builder": "14.371.0",
|
|
34
|
+
"@genesislcap/uvu-playwright-builder": "14.371.0",
|
|
35
|
+
"@genesislcap/vite-builder": "14.371.0",
|
|
36
|
+
"@genesislcap/webpack-builder": "14.371.0",
|
|
37
37
|
"@types/json-schema": "^7.0.11"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@genesislcap/expression-builder": "14.371.0
|
|
41
|
-
"@genesislcap/foundation-logger": "14.371.0
|
|
40
|
+
"@genesislcap/expression-builder": "14.371.0",
|
|
41
|
+
"@genesislcap/foundation-logger": "14.371.0",
|
|
42
42
|
"@microsoft/fast-components": "2.30.6",
|
|
43
43
|
"@microsoft/fast-element": "1.14.0",
|
|
44
44
|
"@microsoft/fast-foundation": "2.49.6",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"customElements": "dist/custom-elements.json",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "ea4401059f690d90b8c5ebbfdd0c9bea654fa611"
|
|
60
60
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deep merges two objects, with source values taking precedence over target values.
|
|
3
|
-
* Arrays are replaced (not merged), and null/undefined values in source are preserved.
|
|
4
|
-
*
|
|
5
|
-
* @param target - The target object to merge into (defaults/base values)
|
|
6
|
-
* @param source - The source object to merge from (overrides)
|
|
7
|
-
* @returns A new merged object with source values taking precedence
|
|
8
|
-
* @public
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const defaults = { a: 1, b: { c: 2, d: 3 } };
|
|
12
|
-
* const overrides = { b: { c: 4 } };
|
|
13
|
-
* const merged = deepMerge(defaults, overrides);
|
|
14
|
-
* // Result: { a: 1, b: { c: 4, d: 3 } }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare const deepMerge: <T extends Record<string, any>>(target: T, source: Partial<T>) => T;
|
|
18
|
-
//# sourceMappingURL=deepMerge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deepMerge.d.ts","sourceRoot":"","sources":["../../../src/utils/deepMerge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,OAAO,CAAC,CAAC,CAAC,KAAG,CAsCxF,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deep merges two objects, with source values taking precedence over target values.
|
|
3
|
-
* Arrays are replaced (not merged), and null/undefined values in source are preserved.
|
|
4
|
-
*
|
|
5
|
-
* @param target - The target object to merge into (defaults/base values)
|
|
6
|
-
* @param source - The source object to merge from (overrides)
|
|
7
|
-
* @returns A new merged object with source values taking precedence
|
|
8
|
-
* @public
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const defaults = { a: 1, b: { c: 2, d: 3 } };
|
|
12
|
-
* const overrides = { b: { c: 4 } };
|
|
13
|
-
* const merged = deepMerge(defaults, overrides);
|
|
14
|
-
* // Result: { a: 1, b: { c: 4, d: 3 } }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export const deepMerge = (target, source) => {
|
|
18
|
-
const output = structuredClone(target);
|
|
19
|
-
if (!source || typeof source !== 'object' || Array.isArray(source)) {
|
|
20
|
-
return source !== undefined ? source : output;
|
|
21
|
-
}
|
|
22
|
-
Object.keys(source).forEach((key) => {
|
|
23
|
-
const sourceValue = source[key];
|
|
24
|
-
const targetValue = output[key];
|
|
25
|
-
// If source value is null or undefined, skip it (preserve target value)
|
|
26
|
-
if (sourceValue === null || sourceValue === undefined) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
// Type guard for Date check
|
|
30
|
-
const isDate = (value) => value instanceof Date;
|
|
31
|
-
// If both are plain objects (not arrays, dates, etc.), recursively merge
|
|
32
|
-
if (sourceValue &&
|
|
33
|
-
typeof sourceValue === 'object' &&
|
|
34
|
-
!Array.isArray(sourceValue) &&
|
|
35
|
-
!isDate(sourceValue) &&
|
|
36
|
-
targetValue &&
|
|
37
|
-
typeof targetValue === 'object' &&
|
|
38
|
-
!Array.isArray(targetValue) &&
|
|
39
|
-
!isDate(targetValue)) {
|
|
40
|
-
output[key] = deepMerge(targetValue, sourceValue);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
// Otherwise, source value overrides target value
|
|
44
|
-
output[key] = sourceValue;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return output;
|
|
48
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
-
|
|
3
|
-
[Home](./index.md) > [@genesislcap/foundation-utils](./foundation-utils.md) > [deepMerge](./foundation-utils.deepmerge.md)
|
|
4
|
-
|
|
5
|
-
## deepMerge() function
|
|
6
|
-
|
|
7
|
-
Deep merges two objects, with source values taking precedence over target values. Arrays are replaced (not merged), and null/undefined values in source are preserved.
|
|
8
|
-
|
|
9
|
-
**Signature:**
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
deepMerge: <T extends Record<string, any>>(target: T, source: Partial<T>) => T
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
<table><thead><tr><th>
|
|
18
|
-
|
|
19
|
-
Parameter
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
</th><th>
|
|
23
|
-
|
|
24
|
-
Type
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</th><th>
|
|
28
|
-
|
|
29
|
-
Description
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</th></tr></thead>
|
|
33
|
-
<tbody><tr><td>
|
|
34
|
-
|
|
35
|
-
target
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</td><td>
|
|
39
|
-
|
|
40
|
-
T
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</td><td>
|
|
44
|
-
|
|
45
|
-
The target object to merge into (defaults/base values)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</td></tr>
|
|
49
|
-
<tr><td>
|
|
50
|
-
|
|
51
|
-
source
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</td><td>
|
|
55
|
-
|
|
56
|
-
Partial<T>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</td><td>
|
|
60
|
-
|
|
61
|
-
The source object to merge from (overrides)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</td></tr>
|
|
65
|
-
</tbody></table>
|
|
66
|
-
|
|
67
|
-
**Returns:**
|
|
68
|
-
|
|
69
|
-
T
|
|
70
|
-
|
|
71
|
-
A new merged object with source values taking precedence
|
|
72
|
-
|
|
73
|
-
## Example
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```ts
|
|
77
|
-
const defaults = { a: 1, b: { c: 2, d: 3 } };
|
|
78
|
-
const overrides = { b: { c: 4 } };
|
|
79
|
-
const merged = deepMerge(defaults, overrides);
|
|
80
|
-
// Result: { a: 1, b: { c: 4, d: 3 } }
|
|
81
|
-
```
|
|
82
|
-
|