@punks/backend-core 0.0.35 → 0.0.36

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.
@@ -6,3 +6,4 @@ export declare const buildObject: <T>(...props: {
6
6
  key: string;
7
7
  value: any;
8
8
  }[]) => T;
9
+ export declare const mergeDeep: <T>(a: any, b: any) => T;
package/dist/esm/index.js CHANGED
@@ -272,6 +272,21 @@ const buildObject = (...props) => {
272
272
  }
273
273
  return out;
274
274
  };
275
+ const mergeDeep = (a, b) => {
276
+ const c = { ...(a ?? {}) };
277
+ for (const key in b ?? {}) {
278
+ if (b.hasOwnProperty(key)) {
279
+ const value = b[key];
280
+ if (typeof value === "object" && !Array.isArray(value)) {
281
+ c[key] = mergeDeep(c[key] ?? {}, value);
282
+ }
283
+ else {
284
+ c[key] = value;
285
+ }
286
+ }
287
+ }
288
+ return c;
289
+ };
275
290
 
276
291
  const pluralize = (word) => {
277
292
  return word.endsWith("s") ? `${word}es` : `${word}s`;
@@ -28490,5 +28505,5 @@ Log.enabled = true;
28490
28505
  Log.level = LogLevel.Debug;
28491
28506
  Log.metaSerialization = MetaSerializationType.None;
28492
28507
 
28493
- export { ExcelKeyTransform, Log, LogLevel, MetaSerializationType, addTime, buildObject, buildTree, byField, byFieldDesc, camelToKebabCase, camelToSnakeCase, csvBuild, csvParse, distinct, distinctElements, ensureDirectory, ensureStartSlash, ensureTailingSlash, excelBuild, excelParse, first, flatten, getDirectoryFilePaths, getDirectoryPath, groupBy, indexes, isNullOrUndefined, iterate, joinPath, jsonDistinct, last, mapOrThrow, newUuid, notNull, notUndefined, pluralize, processArrayDifferences, range, removeUndefinedProps, selectMany, sleep, sort, splitPath, subArrays, subtractTime, toCamelCase, toDict, toItemsDict, toItemsMap, toMap, toTitleCase, trim$1 as trim, trimEnd, trimStart };
28508
+ export { ExcelKeyTransform, Log, LogLevel, MetaSerializationType, addTime, buildObject, buildTree, byField, byFieldDesc, camelToKebabCase, camelToSnakeCase, csvBuild, csvParse, distinct, distinctElements, ensureDirectory, ensureStartSlash, ensureTailingSlash, excelBuild, excelParse, first, flatten, getDirectoryFilePaths, getDirectoryPath, groupBy, indexes, isNullOrUndefined, iterate, joinPath, jsonDistinct, last, mapOrThrow, mergeDeep, newUuid, notNull, notUndefined, pluralize, processArrayDifferences, range, removeUndefinedProps, selectMany, sleep, sort, splitPath, subArrays, subtractTime, toCamelCase, toDict, toItemsDict, toItemsMap, toMap, toTitleCase, trim$1 as trim, trimEnd, trimStart };
28494
28509
  //# sourceMappingURL=index.js.map