Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-fluent-validation

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-fluent-validation - npm Package Compare versions

Comparing version 0.6.2 to 0.7.0

10

dist/middleware.js

@@ -43,7 +43,13 @@ "use strict";

function validate(ctx, setup, obj, hooks) {
if (hooks !== undefined && hooks !== null && hooks.before !== undefined && hooks.before !== null) {
if (hooks !== undefined &&
hooks !== null &&
hooks.before !== undefined &&
hooks.before !== null) {
runHooks(ctx, hooks.before, obj, obj);
}
runValidators(ctx, setup, obj, obj);
if (hooks !== undefined && hooks !== null && hooks.after !== undefined && hooks.after !== null) {
if (hooks !== undefined &&
hooks !== null &&
hooks.after !== undefined &&
hooks.after !== null) {
runHooks(ctx, hooks.after, obj, obj);

@@ -50,0 +56,0 @@ }

8

dist/validator-builder.js

@@ -26,2 +26,3 @@ "use strict";

this.args = [];
this.message = '';
}

@@ -141,5 +142,3 @@ fn(value) {

length(min = 1, max) {
return this.addValidator(({ value }, min, max) => !helpers_1.exists(value) ? true : typeof value === 'string' && v.isLength(value, min, max), `is an invalid string or does not have a min length of ${min}${max
? ` and a max length of ${max}`
: ''}.`, min, max);
return this.addValidator(({ value }, min, max) => !helpers_1.exists(value) ? true : typeof value === 'string' && v.isLength(value, min, max), `is an invalid string or does not have a min length of ${min}${max ? ` and a max length of ${max}` : ''}.`, min, max);
}

@@ -198,2 +197,5 @@ base64() {

}
creditCard() {
return this.addValidator(({ value }) => (!helpers_1.exists(value) ? true : v.isCreditCard(value)), 'is an invalid credit card number.');
}
}

@@ -200,0 +202,0 @@ exports.ValidatorBuilder = ValidatorBuilder;

{
"name": "koa-fluent-validation",
"version": "0.6.2",
"version": "0.7.0",
"main": "dist/index.js",

@@ -39,3 +39,2 @@ "types": "types.d.ts",

],
"mapCoverage": true,
"verbose": false

@@ -47,18 +46,18 @@ },

"devDependencies": {
"@types/jest": "^21.1.4",
"concurrently": "^3.5.0",
"jest": "^21.2.1",
"ts-jest": "^21.1.3",
"typescript": "2.5.3"
"@types/jest": "^22.2.0",
"concurrently": "^3.5.1",
"jest": "^22.4.2",
"ts-jest": "^22.4.1",
"typescript": "2.7.2"
},
"dependencies": {
"@types/koa": "^2.0.39",
"@types/koa-bodyparser": "^3.0.23",
"@types/koa": "^2.0.44",
"@types/koa-bodyparser": "^4.2.0",
"@types/lodash.get": "^4.4.2",
"@types/lodash.set": "^4.3.2",
"@types/validator": "^6.3.0",
"@types/validator": "^9.4.0",
"lodash.get": "^4.4.2",
"lodash.set": "^4.3.2",
"validator": "^9.0.0"
"validator": "^9.4.1"
}
}
/// <reference types="validator" />
// export { middleware as validation } from './middleware';
import 'koa-bodyparser';
import * as Koa from 'koa';

@@ -29,8 +30,8 @@

interface Request {
body: any;
}
// interface Request {
// body: any;
// }
}
export declare function validation(): (ctx: Koa.Context, next: () => Promise<any>) => Promise<void>
export declare function validation(): (ctx: Koa.Context, next: () => Promise<any>) => Promise<void>;

@@ -70,7 +71,12 @@ // export { validatorBuilder as v, addCustom as addCustomValidator, IValidators } from './validator-builder';

mobilePhone(locale?: ValidatorJS.MobilePhoneLocale): IValidators;
ipAddress(version?: number): IValidators;
ipAddress(version?: number): IValidators;
creditCard(): IValidators;
}
export declare const v: () => IValidators;
export declare function addCustomValidator(name: string, fn: ValidatorFn, errorMessage?: string): void
export declare function addCustomValidator(
name: string,
fn: ValidatorFn,
errorMessage?: string
): void;

@@ -92,6 +98,6 @@ // export { filterBuilder as f, addCustom as addCustomFilter, IFilters } from './filter-builder';

export declare function f(): IFilters
export declare function addCustomFilter(name: string, fn: FilterFn): void
export declare function f(): IFilters;
export declare function addCustomFilter(name: string, fn: FilterFn): void;
// export { exists } from './helpers';
export declare function exists(value: any): boolean
export declare function exists(value: any): boolean;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc