fast-redact
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -134,3 +134,7 @@ 'use strict' | ||
} else { | ||
wcov[k] = (nv === undefined && censor !== undefined) || (has(wcov, k) && nv === ov) ? wcov[k] : nv | ||
if (wcov[k] === nv) { | ||
exists = false | ||
} else { | ||
wcov[k] = (nv === undefined && censor !== undefined) || (has(wcov, k) && nv === ov) ? wcov[k] : nv | ||
} | ||
} | ||
@@ -151,2 +155,6 @@ } | ||
if (typeof n !== 'object') break | ||
// prevent circular structure, see https://github.com/pinojs/pino/issues/1513 | ||
if (ov === oov) { | ||
exists = false | ||
} | ||
} | ||
@@ -153,0 +161,0 @@ return { value: ov, parent: oov, exists } |
{ | ||
"name": "fast-redact", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "very fast object redaction", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1251,1 +1251,30 @@ 'use strict' | ||
}) | ||
test('handles multi wildcards with pattern repetition', ({ end, is }) => { | ||
const redact = fastRedact({ | ||
paths: ['*.d', '*.*.d', '*.*.*.d'] | ||
}) | ||
const o = { | ||
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' } } | ||
} | ||
is(redact(o), '{"x":{"c":{"d":"[REDACTED]","e":"leave me be"}},"y":{"c":{"d":"[REDACTED]","f":"I want to live"}},"z":{"c":{"d":"[REDACTED]","g":"I want to run in a stream"}}}') | ||
end() | ||
}) | ||
test('restores multi wildcards with pattern repetition', ({ end, is }) => { | ||
const redact = fastRedact({ | ||
paths: ['*.d', '*.*.d', '*.*.*.d'] | ||
}) | ||
const o = { | ||
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' } } | ||
} | ||
redact(o) | ||
is(o.x.c.d, 'hide me') | ||
is(o.y.c.d, 'and me') | ||
is(o.z.c.d, 'and also I') | ||
end() | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81830
1920