File: index.d.ts

Recommend this page to a friend!
  Classes of Harcharan Singh  >  Node Input Validator  >  index.d.ts  >  Download  
File: index.d.ts
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Node Input Validator
Validate submitted input values in Node.js
Author: By
Last change: v3.4
Date: 18 days ago
Size: 1,658 bytes


Class file image Download
declare class Validator {

    errors: any = {};

    validations: any = {};

    filters: any = {};

    lang: string;

    postValidations: any = [];

    inputs: any = {};

    filterInputs: any = {};

    rules: any = {};

    customMessages: any = {};

    constructor(inputs: any, rules: any, customMessages?: any = {});

    setAttributeNames(niceNames: any);

    static make(inputs: any, rules: any, messages: any = {}): Validator;

    static create(rules: any, messages: any = {}): Validator;

    apply(inputs: any): Promise;

    check(): Promise;

    fails(): Promise;

    passes(): Promise;

    setLang(lang: string);

    isEmpty(value: any): boolean;

    addError(key: string, rule: string, messages?: string);

    addPostRule(rule: any): void;

    addPostRules(rules: Array<any>): void;

    check(): Promise;

    parseKey(key: any, data: any): any;

    inputVal(attribute: any, multiple: boolean = false): any;

    parseRules(rules: any);

    makeValidationsFromArray(rules: any);

    populateRule(attribute: any);

    parseMessage(rule: any, field: any, value?: any, args: any = []);

    parseExistingMessageOnly(rule: any, field: any, value?: any, args: any = []);

declare namespace Validator {

    declare function setLang(lang: string);

    declare function extend(
        rule: string,
        func: any

    declare function messages(
        newMessages: any,
        lang: string = 'en'

    declare function customMessages(
        customMessages: any,
        lang: string = 'en'

    function koa();

    export { setLang, extend, messages, customMessages, koa };

export = Validator;