@genesislcap/foundation-utils 14.370.1-alpha-fa13546.0 → 14.371.0-FUI-2456.1
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 +171 -120
- package/dist/dts/utils/deepMerge.d.ts +18 -0
- package/dist/dts/utils/deepMerge.d.ts.map +1 -0
- package/dist/dts/utils/index.d.ts +1 -0
- package/dist/dts/utils/index.d.ts.map +1 -1
- package/dist/esm/utils/deepMerge.js +48 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/foundation-utils.api.json +88 -0
- package/dist/foundation-utils.d.ts +18 -0
- package/docs/api/foundation-utils.deepmerge.md +82 -0
- package/docs/api/foundation-utils.md +11 -0
- package/docs/api-report.md.api.md +3 -0
- package/package.json +11 -11
|
@@ -474,6 +474,126 @@
|
|
|
474
474
|
}
|
|
475
475
|
]
|
|
476
476
|
},
|
|
477
|
+
{
|
|
478
|
+
"kind": "javascript-module",
|
|
479
|
+
"path": "src/design-system/design-system.ts",
|
|
480
|
+
"declarations": [
|
|
481
|
+
{
|
|
482
|
+
"kind": "function",
|
|
483
|
+
"name": "assureDesignSystem",
|
|
484
|
+
"return": {
|
|
485
|
+
"type": {
|
|
486
|
+
"text": "DesignSystemModule"
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
"parameters": [
|
|
490
|
+
{
|
|
491
|
+
"name": "module",
|
|
492
|
+
"type": {
|
|
493
|
+
"text": "DesignSystemModule"
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
],
|
|
497
|
+
"description": "assureDesignSystem.",
|
|
498
|
+
"privacy": "public"
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
"kind": "function",
|
|
502
|
+
"name": "getCurrentDesignSystem",
|
|
503
|
+
"return": {
|
|
504
|
+
"type": {
|
|
505
|
+
"text": ""
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
"parameters": [
|
|
509
|
+
{
|
|
510
|
+
"name": "element",
|
|
511
|
+
"type": {
|
|
512
|
+
"text": "HTMLElement"
|
|
513
|
+
},
|
|
514
|
+
"description": "The starting HTML element"
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
"name": "fallbackPrefix",
|
|
518
|
+
"type": {
|
|
519
|
+
"text": "string"
|
|
520
|
+
},
|
|
521
|
+
"description": "The prefix to fallback to if the provider is not available"
|
|
522
|
+
}
|
|
523
|
+
],
|
|
524
|
+
"description": "Get the current design system provider element and prefix by checking available providers.\nIf no provider is found, falls back to the provided prefix.",
|
|
525
|
+
"privacy": "public"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"kind": "function",
|
|
529
|
+
"name": "getCurrentDesignSystemPrefix",
|
|
530
|
+
"return": {
|
|
531
|
+
"type": {
|
|
532
|
+
"text": ""
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
"parameters": [
|
|
536
|
+
{
|
|
537
|
+
"name": "element",
|
|
538
|
+
"type": {
|
|
539
|
+
"text": "HTMLElement"
|
|
540
|
+
},
|
|
541
|
+
"description": "The starting HTML element"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"name": "fallbackPrefix",
|
|
545
|
+
"type": {
|
|
546
|
+
"text": "string"
|
|
547
|
+
},
|
|
548
|
+
"description": "The prefix to fallback to if the provider is not available"
|
|
549
|
+
}
|
|
550
|
+
],
|
|
551
|
+
"description": "Get the current design system prefix by checking available providers.\nIf no provider is found, falls back to the provided prefix.",
|
|
552
|
+
"privacy": "public"
|
|
553
|
+
}
|
|
554
|
+
],
|
|
555
|
+
"exports": [
|
|
556
|
+
{
|
|
557
|
+
"kind": "js",
|
|
558
|
+
"name": "assureDesignSystem",
|
|
559
|
+
"declaration": {
|
|
560
|
+
"name": "assureDesignSystem",
|
|
561
|
+
"module": "src/design-system/design-system.ts"
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"kind": "js",
|
|
566
|
+
"name": "getCurrentDesignSystem",
|
|
567
|
+
"declaration": {
|
|
568
|
+
"name": "getCurrentDesignSystem",
|
|
569
|
+
"module": "src/design-system/design-system.ts"
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"kind": "js",
|
|
574
|
+
"name": "getCurrentDesignSystemPrefix",
|
|
575
|
+
"declaration": {
|
|
576
|
+
"name": "getCurrentDesignSystemPrefix",
|
|
577
|
+
"module": "src/design-system/design-system.ts"
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
]
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
"kind": "javascript-module",
|
|
584
|
+
"path": "src/design-system/index.ts",
|
|
585
|
+
"declarations": [],
|
|
586
|
+
"exports": [
|
|
587
|
+
{
|
|
588
|
+
"kind": "js",
|
|
589
|
+
"name": "*",
|
|
590
|
+
"declaration": {
|
|
591
|
+
"name": "*",
|
|
592
|
+
"package": "./design-system"
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
]
|
|
596
|
+
},
|
|
477
597
|
{
|
|
478
598
|
"kind": "javascript-module",
|
|
479
599
|
"path": "src/env/index.ts",
|
|
@@ -949,126 +1069,6 @@
|
|
|
949
1069
|
}
|
|
950
1070
|
]
|
|
951
1071
|
},
|
|
952
|
-
{
|
|
953
|
-
"kind": "javascript-module",
|
|
954
|
-
"path": "src/design-system/design-system.ts",
|
|
955
|
-
"declarations": [
|
|
956
|
-
{
|
|
957
|
-
"kind": "function",
|
|
958
|
-
"name": "assureDesignSystem",
|
|
959
|
-
"return": {
|
|
960
|
-
"type": {
|
|
961
|
-
"text": "DesignSystemModule"
|
|
962
|
-
}
|
|
963
|
-
},
|
|
964
|
-
"parameters": [
|
|
965
|
-
{
|
|
966
|
-
"name": "module",
|
|
967
|
-
"type": {
|
|
968
|
-
"text": "DesignSystemModule"
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
],
|
|
972
|
-
"description": "assureDesignSystem.",
|
|
973
|
-
"privacy": "public"
|
|
974
|
-
},
|
|
975
|
-
{
|
|
976
|
-
"kind": "function",
|
|
977
|
-
"name": "getCurrentDesignSystem",
|
|
978
|
-
"return": {
|
|
979
|
-
"type": {
|
|
980
|
-
"text": ""
|
|
981
|
-
}
|
|
982
|
-
},
|
|
983
|
-
"parameters": [
|
|
984
|
-
{
|
|
985
|
-
"name": "element",
|
|
986
|
-
"type": {
|
|
987
|
-
"text": "HTMLElement"
|
|
988
|
-
},
|
|
989
|
-
"description": "The starting HTML element"
|
|
990
|
-
},
|
|
991
|
-
{
|
|
992
|
-
"name": "fallbackPrefix",
|
|
993
|
-
"type": {
|
|
994
|
-
"text": "string"
|
|
995
|
-
},
|
|
996
|
-
"description": "The prefix to fallback to if the provider is not available"
|
|
997
|
-
}
|
|
998
|
-
],
|
|
999
|
-
"description": "Get the current design system provider element and prefix by checking available providers.\nIf no provider is found, falls back to the provided prefix.",
|
|
1000
|
-
"privacy": "public"
|
|
1001
|
-
},
|
|
1002
|
-
{
|
|
1003
|
-
"kind": "function",
|
|
1004
|
-
"name": "getCurrentDesignSystemPrefix",
|
|
1005
|
-
"return": {
|
|
1006
|
-
"type": {
|
|
1007
|
-
"text": ""
|
|
1008
|
-
}
|
|
1009
|
-
},
|
|
1010
|
-
"parameters": [
|
|
1011
|
-
{
|
|
1012
|
-
"name": "element",
|
|
1013
|
-
"type": {
|
|
1014
|
-
"text": "HTMLElement"
|
|
1015
|
-
},
|
|
1016
|
-
"description": "The starting HTML element"
|
|
1017
|
-
},
|
|
1018
|
-
{
|
|
1019
|
-
"name": "fallbackPrefix",
|
|
1020
|
-
"type": {
|
|
1021
|
-
"text": "string"
|
|
1022
|
-
},
|
|
1023
|
-
"description": "The prefix to fallback to if the provider is not available"
|
|
1024
|
-
}
|
|
1025
|
-
],
|
|
1026
|
-
"description": "Get the current design system prefix by checking available providers.\nIf no provider is found, falls back to the provided prefix.",
|
|
1027
|
-
"privacy": "public"
|
|
1028
|
-
}
|
|
1029
|
-
],
|
|
1030
|
-
"exports": [
|
|
1031
|
-
{
|
|
1032
|
-
"kind": "js",
|
|
1033
|
-
"name": "assureDesignSystem",
|
|
1034
|
-
"declaration": {
|
|
1035
|
-
"name": "assureDesignSystem",
|
|
1036
|
-
"module": "src/design-system/design-system.ts"
|
|
1037
|
-
}
|
|
1038
|
-
},
|
|
1039
|
-
{
|
|
1040
|
-
"kind": "js",
|
|
1041
|
-
"name": "getCurrentDesignSystem",
|
|
1042
|
-
"declaration": {
|
|
1043
|
-
"name": "getCurrentDesignSystem",
|
|
1044
|
-
"module": "src/design-system/design-system.ts"
|
|
1045
|
-
}
|
|
1046
|
-
},
|
|
1047
|
-
{
|
|
1048
|
-
"kind": "js",
|
|
1049
|
-
"name": "getCurrentDesignSystemPrefix",
|
|
1050
|
-
"declaration": {
|
|
1051
|
-
"name": "getCurrentDesignSystemPrefix",
|
|
1052
|
-
"module": "src/design-system/design-system.ts"
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
]
|
|
1056
|
-
},
|
|
1057
|
-
{
|
|
1058
|
-
"kind": "javascript-module",
|
|
1059
|
-
"path": "src/design-system/index.ts",
|
|
1060
|
-
"declarations": [],
|
|
1061
|
-
"exports": [
|
|
1062
|
-
{
|
|
1063
|
-
"kind": "js",
|
|
1064
|
-
"name": "*",
|
|
1065
|
-
"declaration": {
|
|
1066
|
-
"name": "*",
|
|
1067
|
-
"package": "./design-system"
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
]
|
|
1071
|
-
},
|
|
1072
1072
|
{
|
|
1073
1073
|
"kind": "javascript-module",
|
|
1074
1074
|
"path": "src/error/errorMap.ts",
|
|
@@ -3489,6 +3489,49 @@
|
|
|
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
|
+
},
|
|
3492
3535
|
{
|
|
3493
3536
|
"kind": "javascript-module",
|
|
3494
3537
|
"path": "src/utils/delay.ts",
|
|
@@ -3623,6 +3666,14 @@
|
|
|
3623
3666
|
"path": "src/utils/index.ts",
|
|
3624
3667
|
"declarations": [],
|
|
3625
3668
|
"exports": [
|
|
3669
|
+
{
|
|
3670
|
+
"kind": "js",
|
|
3671
|
+
"name": "*",
|
|
3672
|
+
"declaration": {
|
|
3673
|
+
"name": "*",
|
|
3674
|
+
"package": "./deepMerge"
|
|
3675
|
+
}
|
|
3676
|
+
},
|
|
3626
3677
|
{
|
|
3627
3678
|
"kind": "js",
|
|
3628
3679
|
"name": "*",
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
};
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1811,6 +1811,94 @@
|
|
|
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
|
+
},
|
|
1814
1902
|
{
|
|
1815
1903
|
"kind": "Variable",
|
|
1816
1904
|
"canonicalReference": "@genesislcap/foundation-utils!DEFAULT_ORGANISATION:var",
|
|
@@ -225,6 +225,24 @@ 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
|
+
|
|
228
246
|
/**
|
|
229
247
|
* The default Organisation value, used in auth/login flow [`genesislcap-foundation-login`](https://link-to-docs).
|
|
230
248
|
* @remarks Optional.
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
|
|
@@ -258,6 +258,17 @@ 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
|
+
|
|
261
272
|
</td></tr>
|
|
262
273
|
<tr><td>
|
|
263
274
|
|
|
@@ -143,6 +143,9 @@ 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
|
+
|
|
146
149
|
// @public
|
|
147
150
|
export let DEFAULT_ORGANISATION: string;
|
|
148
151
|
|
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.
|
|
4
|
+
"version": "14.371.0-FUI-2456.1",
|
|
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.
|
|
31
|
-
"@genesislcap/genx": "14.
|
|
32
|
-
"@genesislcap/rollup-builder": "14.
|
|
33
|
-
"@genesislcap/ts-builder": "14.
|
|
34
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
35
|
-
"@genesislcap/vite-builder": "14.
|
|
36
|
-
"@genesislcap/webpack-builder": "14.
|
|
30
|
+
"@genesislcap/foundation-testing": "14.371.0-FUI-2456.1",
|
|
31
|
+
"@genesislcap/genx": "14.371.0-FUI-2456.1",
|
|
32
|
+
"@genesislcap/rollup-builder": "14.371.0-FUI-2456.1",
|
|
33
|
+
"@genesislcap/ts-builder": "14.371.0-FUI-2456.1",
|
|
34
|
+
"@genesislcap/uvu-playwright-builder": "14.371.0-FUI-2456.1",
|
|
35
|
+
"@genesislcap/vite-builder": "14.371.0-FUI-2456.1",
|
|
36
|
+
"@genesislcap/webpack-builder": "14.371.0-FUI-2456.1",
|
|
37
37
|
"@types/json-schema": "^7.0.11"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@genesislcap/expression-builder": "14.
|
|
41
|
-
"@genesislcap/foundation-logger": "14.
|
|
40
|
+
"@genesislcap/expression-builder": "14.371.0-FUI-2456.1",
|
|
41
|
+
"@genesislcap/foundation-logger": "14.371.0-FUI-2456.1",
|
|
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": "c3c009d8ba522f9a7cc445c623973248e5e26cf2"
|
|
60
60
|
}
|