UNPKG

indicative-compiler

Version:

Indicative compiler to compile parsed schema into highly optimized functions

32 lines (31 loc) 1.05 kB
/** * @module compiler/sanitizer */ import { ParsedRule } from 'indicative-parser'; import { SanitizationDefinition, SanitizationDataRoot } from '../Contracts'; /** * Runs an array of sanitizations on a given field. */ export declare class SanitizationsRunner { private field; private dotPath; private sanitizations; constructor(field: string, dotPath: string[], rules: ParsedRule[], sanitizations: { [key: string]: SanitizationDefinition; }); /** * Pull sanitizations for the list defined rules. */ private computeSanitizations; /** * Returns a fresh data copy by copying some of the values from the actual * data and then mutating the `tip` and `pointer`. The tip and pointer * are mutated so that the sanitization function receives the closest * object from the pointer, resulting in performant code. */ private getDataCopy; /** * Execute all sanitization in series for a given filed */ exec(data: SanitizationDataRoot, config: unknown): void; }