mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-04 16:04:45 +08:00
Merge pull request #8692 from vladeck/master
PR to include jsen (JSON Sentinel) typescript definition
This commit is contained in:
+3482
File diff suppressed because it is too large
Load Diff
Vendored
+52
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user