UNPKG

indicative-compiler

Version:

Indicative compiler to compile parsed schema into highly optimized functions

24 lines (23 loc) 824 B
/** * @module compiler/validator */ import { Schema, Messages, TypedSchema, ParsedSchema, ParsedMessages, ParsedTypedSchema } from 'indicative-parser'; import { ArrayWrapper } from './ArrayWrapper'; import { ValidationDefinition } from '../Contracts'; import { ValidationsRunner } from './ValidationsRunner'; /** * Compiles rules and messages schema to an array of top level * functions highly optimized for speed. */ export declare class Compiler { private validations; parsedSchema: ParsedSchema; parsedMessages: ParsedMessages; constructor(schema: Schema | ParsedTypedSchema<TypedSchema>, messages: Messages, validations: { [key: string]: ValidationDefinition; }); /** * Compiles the schema to an array of functions */ compile(): (ValidationsRunner | ArrayWrapper)[]; }