Socket
Socket
Sign inDemoInstall

class-validator

Package Overview
Dependencies
Maintainers
3
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

class-validator - npm Package Compare versions

Comparing version 0.10.0 to 0.10.1

6

decorator/decorators.d.ts

@@ -129,3 +129,3 @@ /// <reference types="validator" />

*/
export declare function IsNumberString(validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
export declare function IsNumberString(validationOptions?: ValidationOptions, NumberOptions?: IsNumberOptions): (object: Object, propertyName: string) => void;
/**

@@ -142,7 +142,7 @@ * Checks if the string contains the seed.

*/
export declare function IsAlpha(validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
export declare function IsAlpha(locale?: string, validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
/**
* Checks if the string contains only letters and numbers.
*/
export declare function IsAlphanumeric(validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
export declare function IsAlphanumeric(locale?: string, validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
/**

@@ -149,0 +149,0 @@ * Checks if the given number is a valid decimal.

@@ -493,3 +493,3 @@ "use strict";

*/
function IsNumberString(validationOptions) {
function IsNumberString(validationOptions, NumberOptions) {
return function (object, propertyName) {

@@ -500,2 +500,3 @@ var args = {

propertyName: propertyName,
constraints: [NumberOptions],
validationOptions: validationOptions

@@ -545,3 +546,3 @@ };

*/
function IsAlpha(validationOptions) {
function IsAlpha(locale, validationOptions) {
return function (object, propertyName) {

@@ -552,2 +553,3 @@ var args = {

propertyName: propertyName,
constraints: [locale],
validationOptions: validationOptions

@@ -562,3 +564,3 @@ };

*/
function IsAlphanumeric(validationOptions) {
function IsAlphanumeric(locale, validationOptions) {
return function (object, propertyName) {

@@ -569,2 +571,3 @@ var args = {

propertyName: propertyName,
constraints: [locale],
validationOptions: validationOptions

@@ -571,0 +574,0 @@ };

{
"name": "class-validator",
"private": false,
"version": "0.10.0",
"version": "0.10.1",
"description": "Class-based validation with Typescript / ES6 / ES5 using decorators or validation schemas. Supports both node.js and browser",

@@ -26,3 +26,3 @@ "license": "MIT",

"dependencies": {
"@types/validator": "10.11.2",
"@types/validator": "10.11.3",
"google-libphonenumber": "^3.1.6",

@@ -53,3 +53,3 @@ "validator": "11.1.0"

"gulp-istanbul": "^1.1.3",
"gulp-mocha": "^6.0.0",
"gulp-mocha": "^7.0.1",
"gulp-replace": "^1.0.0",

@@ -56,0 +56,0 @@ "gulp-shell": "^0.7.1",

@@ -131,4 +131,10 @@ "use strict";

}
// handle IS_DEFINED validation type the special way - it should work no matter skipMissingProperties is set or not
// handle IS_DEFINED validation type the special way - it should work no matter skipUndefinedProperties/skipMissingProperties is set or not
this.defaultValidations(object, value, definedMetadatas, validationError.constraints);
if (value === undefined && this.validatorOptions && this.validatorOptions.skipUndefinedProperties === true) {
return;
}
if (value === null && this.validatorOptions && this.validatorOptions.skipNullProperties === true) {
return;
}
if ((value === null || value === undefined) && this.validatorOptions && this.validatorOptions.skipMissingProperties === true) {

@@ -135,0 +141,0 @@ return;

@@ -43,2 +43,4 @@ "use strict";

return eachPrefix + "$property should not be one of the following values: $constraint1";
case this.IS_PORT:
return eachPrefix + "$property must be a port";
/* type checkers */

@@ -167,2 +169,4 @@ case this.IS_BOOLEAN:

return eachPrefix + "$property must match $constraint1 regular expression";
case this.IS_MILITARY_TIME:
return eachPrefix + "$property must be a valid representation of military time in the format HH:MM";
/* array checkers */

@@ -169,0 +173,0 @@ case this.ARRAY_CONTAINS:

@@ -158,3 +158,3 @@ /// <reference types="validator" />

*/
isAlpha(value: string): boolean;
isAlpha(value: string, locale?: ValidatorJS.AlphaLocale): boolean;
/**

@@ -164,3 +164,3 @@ * Checks if the string contains only letters and numbers.

*/
isAlphanumeric(value: string): boolean;
isAlphanumeric(value: string, locale?: ValidatorJS.AlphanumericLocale): boolean;
/**

@@ -167,0 +167,0 @@ * Checks if the string is a valid decimal.

@@ -170,5 +170,5 @@ "use strict";

case ValidationTypes_1.ValidationTypes.IS_ALPHA:
return this.isAlpha(value);
return this.isAlpha(value, metadata.constraints[0]);
case ValidationTypes_1.ValidationTypes.IS_ALPHANUMERIC:
return this.isAlphanumeric(value);
return this.isAlphanumeric(value, metadata.constraints[0]);
case ValidationTypes_1.ValidationTypes.IS_DECIMAL:

@@ -456,4 +456,4 @@ return this.isDecimal(value, metadata.constraints[0]);

*/
Validator.prototype.isAlpha = function (value) {
return typeof value === "string" && this.validatorJs.isAlpha(value);
Validator.prototype.isAlpha = function (value, locale) {
return typeof value === "string" && this.validatorJs.isAlpha(value, locale);
};

@@ -464,4 +464,4 @@ /**

*/
Validator.prototype.isAlphanumeric = function (value) {
return typeof value === "string" && this.validatorJs.isAlphanumeric(value);
Validator.prototype.isAlphanumeric = function (value, locale) {
return typeof value === "string" && this.validatorJs.isAlphanumeric(value, locale);
};

@@ -468,0 +468,0 @@ /**

@@ -6,4 +6,12 @@ /**

/**
* If set to true than validator will skip validation of all properties that are missing in the validating object.
* If set to true then validator will skip validation of all properties that are undefined in the validating object.
*/
skipUndefinedProperties?: boolean;
/**
* If set to true then validator will skip validation of all properties that are null in the validating object.
*/
skipNullProperties?: boolean;
/**
* If set to true then validator will skip validation of all properties that are null or undefined in the validating object.
*/
skipMissingProperties?: boolean;

@@ -10,0 +18,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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