This PR is a draft because I discovered this bug through pino.
The behavior in pino is different than the behavior described in #50. In pino it causes infinite recursion.
The changes in the PR doesn't fix the issue in pino.
Pino reproduction
const pino = require('pino');
const logger = pino({
redact: { paths: ['*.d', '*.*.d', '*.*.*.d'] },
});
const obj = {
x: { c: { d: 'hide me', e: 'leave me be' } },
y: { c: { d: 'and me', f: 'I want to live' } },
z: { c: { d: 'and also I', g: 'I want to run in a stream' } },
};
logger.info(obj);
console.log(obj);
This PR is a draft because I discovered this bug through pino.
The behavior in pino is different than the behavior described in #50. In pino it causes infinite recursion. The changes in the PR doesn't fix the issue in pino.
Pino reproduction