@punks/backend-core 0.0.79 → 0.0.80

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
@@ -439,6 +439,24 @@ const jsonSerialize = (obj, options) => {
439
439
  const spaces = prettify ? 2 : undefined;
440
440
  return JSON.stringify(obj, replacer, spaces);
441
441
  };
442
+ function replaceUndefinedWithNull(obj) {
443
+ if (obj === undefined) {
444
+ return null;
445
+ }
446
+ if (typeof obj !== "object" || obj === null) {
447
+ return obj;
448
+ }
449
+ if (Array.isArray(obj)) {
450
+ return obj.map(replaceUndefinedWithNull);
451
+ }
452
+ const newObj = {};
453
+ for (const key in obj) {
454
+ if (obj.hasOwnProperty(key)) {
455
+ newObj[key] = replaceUndefinedWithNull(obj[key]);
456
+ }
457
+ }
458
+ return newObj;
459
+ }
442
460
 
443
461
  const encodeUtf8 = (value) => Buffer.from(value).toString("utf-8");
444
462
  const decodeUtf8 = (value) => Buffer.from(value, "utf-8");
@@ -31533,6 +31551,7 @@ exports.processArrayDifferences = processArrayDifferences;
31533
31551
  exports.processArrayItemMove = processArrayItemMove;
31534
31552
  exports.range = range;
31535
31553
  exports.removeUndefinedProps = removeUndefinedProps;
31554
+ exports.replaceUndefinedWithNull = replaceUndefinedWithNull;
31536
31555
  exports.selectMany = selectMany;
31537
31556
  exports.serializeQueryString = serializeQueryString;
31538
31557
  exports.sleep = sleep;