Merge pull request #8692 from vladeck/master

PR to include jsen (JSON Sentinel) typescript definition
This commit is contained in:
Masahiro Wakame
2016-03-31 00:16:08 +09:00
2 changed files with 3534 additions and 0 deletions
+3482
View File
File diff suppressed because it is too large Load Diff
+52
View File
@@ -0,0 +1,52 @@
// Type definitions for jsen (JSON Sentinel)
// Project: https://github.com/bugventure/jsen
// Definitions by: Vladimir Đokić <https://github.com/vladeck/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Jsen {
export interface JsenFormats {
[key: string]: string | RegExp | Function;
}
export interface JsenSettings {
missing$Ref?: boolean;
greedy?: boolean;
formats?: JsenFormats;
schemas?: any;
}
export interface JsenBuildSettings {
copy?: boolean;
additionalProperties?: boolean;
}
export interface JsenValidator {
(data?: any): boolean;
build(initial?: any, options?: JsenBuildSettings): any;
errors: JsenValidateError[];
}
export interface JsenValidateError {
path: string;
keyword: string;
message?: string;
}
export interface JsenUnique {
(array: any[]): boolean;
findIndex(array: any[], value: any, comparator: (obj1: any, obj2: any) => boolean): number;
}
export interface JsenMain {
(schema?: any, options?: JsenSettings): JsenValidator;
clone(data: any): any;
equal(a: any, b: any): boolean;
unique: JsenUnique;
}
}
declare module "jsen" {
var _jsen: Jsen.JsenMain;
export = _jsen;
}