@punks/backend-core 0.0.45 → 0.0.46

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.
@@ -9,5 +9,6 @@ export declare const buildObject: <T>(...props: {
9
9
  export declare const mergeDeep: <T>(a: any, b: any) => T;
10
10
  export declare const jsonSerialize: (obj: any, options?: {
11
11
  stripBinaryData?: boolean;
12
+ maxStringsLength?: number;
12
13
  prettify?: boolean;
13
14
  }) => string;
package/dist/esm/index.js CHANGED
@@ -288,8 +288,13 @@ const mergeDeep = (a, b) => {
288
288
  return c;
289
289
  };
290
290
  const jsonSerialize = (obj, options) => {
291
- const { stripBinaryData = true, prettify = false } = options ?? {};
291
+ const { stripBinaryData = true, prettify = false, maxStringsLength, } = options ?? {};
292
292
  const replacer = (key, value) => {
293
+ if (typeof value === "string" && maxStringsLength) {
294
+ return value.length > maxStringsLength
295
+ ? `${value.substring(0, maxStringsLength)}...`
296
+ : value;
297
+ }
293
298
  if (stripBinaryData) {
294
299
  if (value instanceof Buffer) {
295
300
  return `<binary data (${value.length} bytes)>`;