/** * This class provides the functionality of pattern and on-demand anonymization. * The pattern identification itself is provided externally using the constuctor * configuration patameter config.textSplitter */ export class Anonymizer { /** * @param {object} config * @param {boolean} config.anonymize - If set to false methods anonymize() * and deanonymize() will do nothing * @param {object} config.dictionary - Dictionary for the * anonymization (keys are anonymized values, values are original values) * @param {object} config.logger - Logger * @param {string} config.logStr - String that will be added to every log * @param {Function} config.textSplitter - Function used to split text * int parts that has/has not to be anonymized */ constructor(config: { anonymize: boolean; dictionary: object; logger: object; logStr: string; textSplitter: Function; }); /** * Performs pattern anonymization of the value and returns anonymized value * The anonymization is not done in place - a copy of the original object * is created whenever some value has to be anonymized * * @param {string|object|Array} value * @param {Array|null} hint - Array of preferred pattern names * The value ['ALL'] means that any string will be completely anonymized * @returns {string|object|Array|null} - null is returned if no anonymization * is needed */ anonymize(value: string | object | any[], hint?: Array | null): string | object | any[] | null; /** * @param {string|object|Array} value * @returns {string|object|Array} */ deanonymize(value: string | object | any[]): string | object | any[]; /** * @return {boolean} */ somethingAnonymized(): boolean; /** * Returns the dictionary of anonymization replacements that were applied * in scope of the Anonymizer instance (usually Anonymizer is instantiated * with a non-empty dictionary, so the values stored in the dictionary * before are not returned by this method; * Returns null if nothing was anonymized * * @return {object|null} */ getAnonymizationDict(): object | null; #private; }