koa-fluent-validation
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -22,3 +22,3 @@ /// <reference types="validator" /> | ||
email(options?: ValidatorJS.IsEmailOptions): IValidators; | ||
uuid(version?: number): IValidators; | ||
uuid(version?: UUIDVersion): IValidators; | ||
number(strict?: boolean): IValidators; | ||
@@ -42,2 +42,3 @@ float(strict?: boolean, options?: ValidatorJS.IsFloatOptions): IValidators; | ||
} | ||
declare type UUIDVersion = 4 | 3 | 5 | '3' | '4' | '5' | 'all'; | ||
export declare function applyValidator(v: IValidator, value: any): boolean; | ||
@@ -56,3 +57,3 @@ export declare class ValidatorBuilder implements IValidators { | ||
email(options?: ValidatorJS.IsEmailOptions): IValidators; | ||
uuid(version?: number): IValidators; | ||
uuid(version?: UUIDVersion): IValidators; | ||
number(strict?: boolean): IValidators; | ||
@@ -78,1 +79,2 @@ float(strict?: boolean, options?: ValidatorJS.IsFloatOptions): IValidators; | ||
export declare function addCustom(name: string, fn: ValidatorFn, errorMessage?: string): void; | ||
export {}; |
@@ -74,3 +74,3 @@ "use strict"; | ||
uuid(version = 4) { | ||
return this.addValidator(({ value }, version) => (!helpers_1.exists(value) ? true : validator_1.default.isUUID(value.toString(), version)), `is an invalid v${version} UUID.`, version); | ||
return this.addValidator(({ value }, version) => !helpers_1.exists(value) ? true : validator_1.default.isUUID(value.toString(), version), `is an invalid UUID (version: ${version}).`, version); | ||
} | ||
@@ -77,0 +77,0 @@ number(strict = false) { |
{ | ||
"name": "koa-fluent-validation", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"main": "dist/index.js", | ||
@@ -17,6 +17,6 @@ "types": "dist/index.d.ts", | ||
"lint": "tslint -p .", | ||
"build": "yarn lint && rm -rf dist && tsc", | ||
"test": "yarn build && jest --coverage", | ||
"build": "npm run lint && rm -rf dist && tsc", | ||
"test": "npm run build && jest --coverage", | ||
"watch": "concurrently \"tsc --watch\" \"jest --watch --coverage\"", | ||
"prepublish": "yarn test" | ||
"prepublishOnly": "npm run test" | ||
}, | ||
@@ -33,4 +33,4 @@ "files": [ | ||
"@types/jest": "^23.3.9", | ||
"@types/koa-router": "^7.0.33", | ||
"concurrently": "^4.0.1", | ||
"@types/koa-router": "^7.0.35", | ||
"concurrently": "^4.1.0", | ||
"jest": "^23.6.0", | ||
@@ -42,7 +42,7 @@ "ts-jest": "^23.10.4", | ||
"dependencies": { | ||
"@types/koa": "^2.0.46", | ||
"@types/koa-bodyparser": "^5.0.1", | ||
"@types/koa": "^2.0.47", | ||
"@types/koa-bodyparser": "^5.0.2", | ||
"@types/lodash.get": "^4.4.2", | ||
"@types/lodash.set": "^4.3.2", | ||
"@types/validator": "^9.4.0", | ||
"@types/validator": "^9.4.3", | ||
"lodash.get": "^4.4.2", | ||
@@ -49,0 +49,0 @@ "lodash.set": "^4.3.2", |
Sorry, the diff of this file is not supported yet
42143
565
Updated@types/koa@^2.0.47
Updated@types/koa-bodyparser@^5.0.2
Updated@types/validator@^9.4.3