@fibjs/enforce
Advanced tools
Comparing version 0.0.2 to 0.0.3
declare var exports: any | ||
declare module "@fibjs/enforce" { | ||
module enforce { | ||
namespace enforce { | ||
interface enforcementsContainer { | ||
[key: string]: IValidator | ||
} | ||
export interface IEnforce { | ||
@@ -16,6 +20,2 @@ add(property: string, validator: ValidationCallback): IEnforce; | ||
export interface EnforceStatic { | ||
Enforce(options?: Options): IEnforce; | ||
} | ||
export interface Options { | ||
@@ -25,3 +25,3 @@ returnAllErrors: boolean; | ||
interface ContextMap { | ||
export interface ContextMap { | ||
property?: string; | ||
@@ -31,11 +31,11 @@ [name: string]: any; | ||
interface IValidator { | ||
export interface IValidator { | ||
validate(data: any, next: (message?: string) => void, thisArg?: any, contexts?: ContextMap) | ||
} | ||
interface ValidationCallback { | ||
export interface ValidationCallback { | ||
(value: any, next: (errorMessage?: string) => boolean, contexts: ContextMap); | ||
} | ||
interface ValidatorMap { | ||
export interface ValidatorMap { | ||
[property: string]: IValidator[]; | ||
@@ -50,2 +50,16 @@ } | ||
} | ||
export const Enforce: { new (options?: Options): IEnforce; } | ||
export const Validator: { new (options?: Options): IValidator; } | ||
export const lists: enforcementsContainer; | ||
export const ranges: enforcementsContainer; | ||
export const security: enforcementsContainer; | ||
export const patterns: enforcementsContainer; | ||
/* common :start */ | ||
export const required: IValidator; | ||
export const notEmptyString: IValidator; | ||
export const sameAs: IValidator; | ||
/* common :end */ | ||
} | ||
@@ -52,0 +66,0 @@ |
v0.0.2 / 2018-10-11 | ||
v0.0.3 / 2018-10-12 | ||
================== | ||
* typo fix. | ||
v0.0.2 / 2018-10-11 | ||
=================== | ||
* Release v0.0.2 | ||
* normalize typo definitions. | ||
@@ -6,0 +12,0 @@ * add lib/* 2 .gitignore |
@@ -1,3 +0,2 @@ | ||
/// <reference path="enforce.d.ts" /> | ||
/// <reference path="validator.ts" /> | ||
/// <reference path="../@types/index.d.ts" /> | ||
const Validator = require("./validator"); | ||
@@ -11,3 +10,2 @@ class Enforce { | ||
}; | ||
return this; | ||
} | ||
@@ -14,0 +12,0 @@ add(property, validator) { |
@@ -0,1 +1,2 @@ | ||
/// <reference path="../../@types/index.d.ts" /> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -2,0 +3,0 @@ const Validator = require("../validator"); |
@@ -0,1 +1,2 @@ | ||
/// <reference path="../../@types/index.d.ts" /> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -2,0 +3,0 @@ const Validator = require("../validator"); |
@@ -1,3 +0,2 @@ | ||
/// <reference path="../enforce.d.ts" /> | ||
/// <reference path="../validator.ts" /> | ||
/// <reference path="../../@types/index.d.ts" /> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +3,0 @@ const Validator = require("../validator"); |
@@ -0,1 +1,2 @@ | ||
/// <reference path="../../@types/index.d.ts" /> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -2,0 +3,0 @@ const Validator = require("../validator"); |
@@ -1,4 +0,2 @@ | ||
/// <reference path="../enforce.d.ts" /> | ||
/// <reference path="../validator.ts" /> | ||
/// <reference path="patterns.ts" /> | ||
/// <reference path="../../@types/index.d.ts" /> | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +3,0 @@ const patterns = require("./patterns"); |
/// <reference path="../@types/index.d.ts" /> | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const common = require("./enforcements/common"); | ||
exports.Enforce = require("./enforce"); | ||
@@ -10,11 +12,2 @@ exports.Validator = require("./validator"); | ||
exports.security = require("./enforcements/security"); | ||
//Force TypeScript compiler to output our inputs (otherwise it optimizes them away) | ||
exports.Enforce.hasOwnProperty('x'); | ||
exports.Validator.hasOwnProperty('x'); | ||
exports.lists.hasOwnProperty('x'); | ||
exports.ranges.hasOwnProperty('x'); | ||
exports.patterns.hasOwnProperty('x'); | ||
exports.security.hasOwnProperty('x'); | ||
for (var k in common) { | ||
exports[k] = common[k]; | ||
} | ||
__export(require("./enforcements/common")); |
@@ -0,1 +1,2 @@ | ||
/// <reference path="../@types/index.d.ts" /> | ||
class Validator { | ||
@@ -2,0 +3,0 @@ constructor(validate) { |
{ | ||
"name": "@fibjs/enforce", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
108509
1590