When providing path that has nested array, value of all redacted keys in the array gets overwritten to the value of the array's last index object value.
const fastRedact = require("fast-redact");
const redact = fastRedact({
paths: ["a[*].b[*].c"],
});
const obj = {
a: [{ b: [{ c: 1 }, { c: 2 }, { c: 3 }] }],
};
console.log(redact(obj));
console.log(inspect(obj, undefined, null));
Output
{"a":[{"b":[{"c":"[REDACTED]"},{"c":"[REDACTED]"},{"c":"[REDACTED]"}]}]}
{
a: [
{ b: [ { c: 3 }, { c: 3 }, { c: 3 } ] }
]
}
Expected result of c should be retained as 1, 2, 3 respectively.
When providing path that has nested array, value of all redacted keys in the array gets overwritten to the value of the array's last index object value.
Output
Expected result of c should be retained as 1, 2, 3 respectively.