@punks/backend-core 0.0.27 → 0.0.28

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/cjs/index.js CHANGED
@@ -323,6 +323,27 @@ const removeUndefinedProps = (obj, options = { recursive: false }) => {
323
323
  const isNullOrUndefined = (value) => {
324
324
  return value === null || value === undefined;
325
325
  };
326
+ const buildObject = (...props) => {
327
+ const out = {};
328
+ for (const prop of props) {
329
+ const propPath = prop.key.split(".");
330
+ const propName = propPath[0];
331
+ const nestedPropPath = propPath.slice(1).join(".");
332
+ if (nestedPropPath) {
333
+ out[propName] = {
334
+ ...(out[propName] ?? {}),
335
+ ...buildObject({
336
+ key: nestedPropPath,
337
+ value: prop.value,
338
+ }),
339
+ };
340
+ }
341
+ else {
342
+ out[propName] = prop.value;
343
+ }
344
+ }
345
+ return out;
346
+ };
326
347
 
327
348
  const pluralize = (word) => {
328
349
  return word.endsWith("s") ? `${word}es` : `${word}s`;
@@ -28364,6 +28385,7 @@ const excelParse = (file, options) => {
28364
28385
  };
28365
28386
 
28366
28387
  exports.Log = Log;
28388
+ exports.buildObject = buildObject;
28367
28389
  exports.byField = byField;
28368
28390
  exports.byFieldDesc = byFieldDesc;
28369
28391
  exports.camelToKebabCase = camelToKebabCase;