index.d.ts 509 B

12345678910111213141516
  1. export interface StringNode {
  2. value: string;
  3. path: string;
  4. }
  5. export interface StringNodeProcessor {
  6. maskNodes: (nodes: StringNode[]) => StringNode[];
  7. }
  8. export interface StringNodeRule {
  9. type?: "pattern";
  10. pattern: RegExp | string;
  11. replace?: string;
  12. }
  13. export type ReplacerType = ((value: string, path?: string) => string) | StringNodeRule[] | StringNodeProcessor;
  14. export declare function createAnonymizer(replacer: ReplacerType, options?: {
  15. maxDepth?: number;
  16. }): <T>(data: T) => T;