@fibjs/enforce
Advanced tools
Comparing version 0.0.3 to 0.0.4
declare var exports: any | ||
declare module "@fibjs/enforce" { | ||
namespace enforce { | ||
interface enforcementsContainer { | ||
[key: string]: IValidator | ||
} | ||
declare namespace enforce { | ||
interface enforcementValidation { | ||
(...args: any[]): enforce.IValidator | ||
} | ||
export interface IEnforce { | ||
add(property: string, validator: ValidationCallback): IEnforce; | ||
add(property: string, validator: IValidator): IEnforce; | ||
context(): any; | ||
context(name: string): any; | ||
context(name: string, value: any): IEnforce; | ||
clear(); | ||
check(data: any, cb: (error: Error) => void); | ||
check(data: any, cb: (errors: Error[]) => void); | ||
} | ||
interface enforcementsContainer { | ||
[key: string]: enforcementValidation | ||
} | ||
export interface Options { | ||
returnAllErrors: boolean; | ||
} | ||
export interface IEnforce { | ||
add(property: string, validator: ValidationCallback): IEnforce; | ||
add(property: string, validator: IValidator): IEnforce; | ||
context(): any; | ||
context(name: string): any; | ||
context(name: string, value: any): IEnforce; | ||
clear(); | ||
check(data: any, cb: (error: Error) => void); | ||
check(data: any, cb: (errors: Error[]) => void); | ||
} | ||
export interface ContextMap { | ||
property?: string; | ||
[name: string]: any; | ||
} | ||
export interface Options { | ||
returnAllErrors: boolean; | ||
} | ||
export interface IValidator { | ||
validate(data: any, next: (message?: string) => void, thisArg?: any, contexts?: ContextMap) | ||
} | ||
export interface ContextMap { | ||
property?: string; | ||
[name: string]: any; | ||
} | ||
export interface ValidationCallback { | ||
(value: any, next: (errorMessage?: string) => boolean, contexts: ContextMap); | ||
} | ||
export interface IValidator { | ||
validate(data: any, next: (message?: string) => void, thisArg?: any, contexts?: ContextMap) | ||
} | ||
export interface ValidatorMap { | ||
[property: string]: IValidator[]; | ||
} | ||
export interface ValidationCallback { | ||
(value: any, next: (errorMessage?: string) => boolean, contexts: ContextMap); | ||
} | ||
export interface ValidationError extends Error { | ||
property?: string; | ||
value?: any; | ||
msg?: string; | ||
type?: string; | ||
} | ||
export interface ValidatorMap { | ||
[property: string]: IValidator[]; | ||
} | ||
export const Enforce: { new (options?: Options): IEnforce; } | ||
export const Validator: { new (options?: Options): IValidator; } | ||
export interface ValidationError extends Error { | ||
property?: string; | ||
value?: any; | ||
msg?: string; | ||
type?: string; | ||
} | ||
export const lists: enforcementsContainer; | ||
export const ranges: enforcementsContainer; | ||
export const security: enforcementsContainer; | ||
export const patterns: enforcementsContainer; | ||
export const Enforce: { new (options?: Options): IEnforce; } | ||
export const Validator: { new (options?: Options): IValidator; } | ||
/* common :start */ | ||
export const required: IValidator; | ||
export const notEmptyString: IValidator; | ||
export const sameAs: IValidator; | ||
/* common :end */ | ||
} | ||
export const lists: enforcementsContainer; | ||
export const ranges: enforcementsContainer; | ||
export const security: enforcementsContainer; | ||
export const patterns: enforcementsContainer; | ||
export = enforce | ||
/* common :start */ | ||
export const required: enforcementValidation; | ||
export const notEmptyString: enforcementValidation; | ||
export const sameAs: enforcementValidation; | ||
/* common :end */ | ||
} |
v0.0.3 / 2018-10-12 | ||
v0.0.4 / 2018-10-12 | ||
================== | ||
@@ -7,2 +7,8 @@ | ||
v0.0.3 / 2018-10-12 | ||
=================== | ||
* Release v0.0.3 | ||
* typo fix. | ||
v0.0.2 / 2018-10-11 | ||
@@ -9,0 +15,0 @@ =================== |
@@ -1,2 +0,1 @@ | ||
/// <reference path="../../@types/index.d.ts" /> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +2,0 @@ const Validator = require("../validator"); |
@@ -1,2 +0,1 @@ | ||
/// <reference path="../../@types/index.d.ts" /> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +2,0 @@ const patterns = require("./patterns"); |
@@ -1,2 +0,1 @@ | ||
/// <reference path="../@types/index.d.ts" /> | ||
function __export(m) { | ||
@@ -3,0 +2,0 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; |
@@ -1,2 +0,1 @@ | ||
/// <reference path="../@types/index.d.ts" /> | ||
class Validator { | ||
@@ -3,0 +2,0 @@ constructor(validate) { |
{ | ||
"name": "@fibjs/enforce", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
108286
1586