@react-typed-forms/schemas 15.1.2 → 15.2.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/lib/index.cjs +12 -0
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +10 -1
- package/lib/index.js.map +1 -1
- package/lib/util.d.ts +1 -0
- package/package.json +1 -1
- package/src/util.ts +11 -0
package/lib/index.cjs
CHANGED
|
@@ -1366,6 +1366,17 @@ function mergeObjects(o1, o2, doMerge) {
|
|
|
1366
1366
|
}
|
|
1367
1367
|
return result;
|
|
1368
1368
|
}
|
|
1369
|
+
function deepMerge(value, fallback) {
|
|
1370
|
+
if (value == null) return fallback;
|
|
1371
|
+
if (typeof value !== "object") return value;
|
|
1372
|
+
// concat arrays
|
|
1373
|
+
if (Array.isArray(value)) {
|
|
1374
|
+
return value.concat(fallback);
|
|
1375
|
+
}
|
|
1376
|
+
return mergeObjects(value, fallback, function (_, v1, fv) {
|
|
1377
|
+
return deepMerge(v1, fv);
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1369
1380
|
/**
|
|
1370
1381
|
* Coerces a value to a string.
|
|
1371
1382
|
* @param {unknown} v - The value to coerce.
|
|
@@ -3320,6 +3331,7 @@ exports.dataControl = dataControl;
|
|
|
3320
3331
|
exports.dateField = dateField;
|
|
3321
3332
|
exports.dateTimeField = dateTimeField;
|
|
3322
3333
|
exports.dateValidatorOptions = dateValidatorOptions;
|
|
3334
|
+
exports.deepMerge = deepMerge;
|
|
3323
3335
|
exports.defaultCompoundField = defaultCompoundField;
|
|
3324
3336
|
exports.defaultControlForField = defaultControlForField;
|
|
3325
3337
|
exports.defaultDataProps = defaultDataProps;
|