Socket
Socket
Sign inDemoInstall

vweb-mvc

Package Overview
Dependencies
Maintainers
1
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vweb-mvc - npm Package Compare versions

Comparing version 1.1.22 to 1.1.23

18

lib/anno/index.d.ts

@@ -29,9 +29,20 @@ export declare function Controller(name: any): (target: any, property: any) => void;

}
export declare function Validator(options: any): (target: any, property: any, descriptor: any) => void;
declare interface ValidatorDescriptor {
[paramName: string]: Function | Boolean | string | RegExp | {
required: boolean;
valid: Function;
pattern: string | RegExp;
};
}
export declare function Validator(options: ValidatorDescriptor): (target: any, property: any, descriptor: any) => void;
export declare namespace Validator {
var keys: string[];
}
declare type Converters = 'string2bigint' | 'string2int' | 'string2float' | 'convert';
declare interface ConverterDescriptor {
[paramName: string]: Function | Converters | Object;
}
export declare class ParamDescriber {
readonly validator: any;
readonly converter: any;
readonly validator: ValidatorDescriptor;
readonly converter: ConverterDescriptor;
}

@@ -49,1 +60,2 @@ export declare function Param(describer: ParamDescriber): (target: any, property: any, descriptor: any) => void;

}
export {};

3

lib/controller/Parameter.d.ts

@@ -0,3 +1,4 @@

import { HttpMessageConverter } from "./MessageConverter";
export default class Parameter {
readonly messageConverters: any[];
readonly messageConverters: HttpMessageConverter[];
readonly paramConverter: any;

@@ -4,0 +5,0 @@ readonly params: Array<any>;

@@ -149,16 +149,22 @@ "use strict";

let validator = validators[param];
if (validator === true) {
if (!value) {
errors.push(`Require parameter ${param}, but not found`);
}
let required = validator.required || validator === true;
if (required && !value) {
errors.push(`Require parameter ${param}, but not found`);
return;
}
else if (typeof validator === "function") {
let rs = validator.call(this.parameters, value, param);
let valid = validator.valid || validator;
if (typeof valid === "function") {
let rs = valid.call(this.parameters, value, param);
if (rs === false) {
errors.push(`Parameter ${param} invalid`);
return;
}
}
else if (typeof validator === 'string' || validator instanceof RegExp) {
if (!(validator instanceof RegExp ? validator : new RegExp(validator)).test((value || '').toString())) {
let pattern = validator.pattern || validator;
if (typeof pattern === 'string' || pattern instanceof RegExp) {
if (typeof pattern === 'string')
pattern = new RegExp(pattern);
if (!pattern.test(`${value || ''}`)) {
errors.push(`Parameter ${param} not matches`);
return;
}

@@ -165,0 +171,0 @@ }

{
"name": "vweb-mvc",
"version": "1.1.22",
"version": "1.1.23",
"description": "mvc ",

@@ -5,0 +5,0 @@ "main": "./lib/index",

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