import { isDeepStrictEqual } from "node:util"; import JSON5 from "json5";
export function replaceSensitiveValuesInRaw(params: {
raw: string;
sensitiveValues: string[];
redactedSentinel: string;
}): string { // Empty string is not a valid replacement token here: replaceAll("", x) // matches every character boundary and corrupts the whole raw snapshot. const values = [...new Set(params.sensitiveValues)]
.filter((value) => value !== "")
.toSorted((a, b) => b.length - a.length);
let result = params.raw; for (const value of values) {
result = result.replaceAll(value, params.redactedSentinel);
} return result;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.