Merge pull request #8771 from brewsoftware/revalidator

Revalidator
This commit is contained in:
Mohamed Hegazy
2016-06-22 16:34:40 -07:00
committed by GitHub
2 changed files with 51 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
/// <reference path="./revalidator.d.ts" />
revalidator.validate(null, null, null);
+48
View File
@@ -0,0 +1,48 @@
// Type definitions for revalidator 0.3.1
// Project: https://github.com/flatiron/revalidator
// Definitions by: Jason Turner <https://github.com/brewsoftware>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module Revalidator {
interface RevalidatorStatic {
validate(object: any, schema: ISchema, options: any): IReturnMessage;
}
interface IErrrorProperty {
property: string;
message: string;
}
interface IReturnMessage {
valid: boolean;
errors: IErrrorProperty[];
}
interface ISchema {
required?: boolean;
type: string;
pattern?: any;
maxLength?: number;
minLength?: number;
minimum?: number;
maximum?: number;
allowEmpty: boolean;
exclusiveMinimum: number;
exclusiveMaximum?: number;
divisibleBy?: number;
minItems?: number;
maxItems?: number;
uniqueItems?: boolean;
enum?: any;
format?: string;
conform?: (data:any) => boolean;
depdendencies?: string;
}
}
declare var revalidator: Revalidator.RevalidatorStatic;
declare module "revalidator" {
export = revalidator;
}