if (this.sanitizationNeeded(data)) {
// Create copy of data so we are not changing anything important.
- data = structuredClone(data, replacer);
+ data = structuredClone(data);
this.sanitize(data);
}
const ancestors = [];
const loggerReplacers = this.jsonReplacers;
return function cycleReplacer(key, value) {
+ loggerReplacers.every((replacer) => {
+ const oldValue = value;
+ value = replacer(key, value);
+ return oldValue === value;
+ });
if (typeof value === 'object' && value !== null) {
- // this is object where key/value came from
+ // 'this' is object where key/value came from
while (ancestors.length > 0 && ancestors.at(-1) !== this) {
ancestors.pop();
}
}
}
- loggerReplacers.every((replacer) => {
- const oldValue = value;
- value = replacer(key, value);
- return oldValue === value;
- });
return value;
}
}