@visulima/redact
Version:
Detect whether a terminal or browser supports ansi colors.
32 lines (27 loc) • 1.32 kB
TypeScript
type StringAnonymize = {
key: string;
pattern: RegExp | string;
replacement?: string;
};
type Anonymize = {
deep?: boolean;
key: string;
pattern?: RegExp | string;
replacement?: any;
};
type Rules = (Anonymize | StringAnonymize | number | string)[];
type RedactOptions = {
exclude?: (number | string)[];
logger?: {
debug: (message?: any, ...optionalParameters: any[]) => void;
};
};
declare const standardModifierRules: Rules;
declare const stringAnonymize: (input: string, modifiers: Rules, options?: RedactOptions) => string;
declare function redact<V = string, R = V>(input: V, rules: Rules, options?: RedactOptions): R;
declare function redact<V = Error, R = V>(input: V, rules: Rules, options?: RedactOptions): R;
declare function redact<V = Record<string, unknown>, R = V>(input: V, rules: Rules, options?: RedactOptions): R;
declare function redact<V = unknown[], R = V>(input: V, rules: Rules, options?: RedactOptions): R;
declare function redact<V = Map<unknown, unknown>, R = V>(input: V, rules: Rules, options?: RedactOptions): R;
declare function redact<V = Set<unknown>, R = V>(input: V, rules: Rules, options?: RedactOptions): R;
export { type Anonymize, type RedactOptions, type Rules, redact, standardModifierRules as standardRules, stringAnonymize };