Skip to content

Commit

Permalink
Fix #184
Browse files Browse the repository at this point in the history
  • Loading branch information
terehov committed Nov 27, 2022
1 parent 8921947 commit 9eacf77
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/BaseLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ export class BaseLogger<LogObj> {
if (seen.includes(source)) {
return { ...source };
}
seen.push(source);
if (typeof source === "object") {
seen.push(source);
}

return isError(source)
? source // dont copy Error
Expand All @@ -203,7 +205,7 @@ export class BaseLogger<LogObj> {
? source.map((item) => this._recursiveCloneAndMaskValuesOfKeys(item, keys, seen))
: source instanceof Date
? new Date(source.getTime())
: source && typeof source === "object"
: source != null && typeof source === "object"
? Object.getOwnPropertyNames(source).reduce((o, prop) => {
Object.defineProperty(o, prop, Object.getOwnPropertyDescriptor(source, prop)!);
// mask
Expand All @@ -225,7 +227,9 @@ export class BaseLogger<LogObj> {
if (seen.includes(source)) {
return { ...source };
}
seen.push(source);
if (typeof source === "object") {
seen.push(source);
}

return Array.isArray(source)
? source.map((item) => this._recursiveCloneAndExecuteFunctions(item, seen))
Expand Down

0 comments on commit 9eacf77

Please sign in to comment.