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

validate-value

Package Overview
Dependencies
Maintainers
3
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-value - npm Package Compare versions

Comparing version 8.2.0 to 8.3.0

build/lib/getByDataPath.d.ts

8

build/lib/Value.js

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

const ajv_1 = __importDefault(require("ajv"));
const getByDataPath_1 = require("./getByDataPath");
const ValidationError_1 = require("./ValidationError");

@@ -23,2 +24,3 @@ const ajvInstance = new ajv_1.default();

const error = this.validateInternal.errors[0];
const failingValue = getByDataPath_1.getByDataPath({ object: value, dataPath: error.dataPath });
let updatedPath = `${valueName}${error.dataPath.replace(/\//gu, separator)}`;

@@ -39,2 +41,8 @@ let message = 'Validation failed';

}
case 'minLength': {
const minPropertyLength = error.params.limit;
const actualLength = failingValue.length;
message = `String is too short (${actualLength} chars), minimum ${minPropertyLength}`;
break;
}
default: {

@@ -41,0 +49,0 @@ // Intentionally left blank.

@@ -0,1 +1,8 @@

# [8.3.0](https://github.com/thenativeweb/validate-value/compare/8.2.0...8.3.0) (2020-11-13)
### Features
* Add custom error message for minlength validation errors. ([#212](https://github.com/thenativeweb/validate-value/issues/212)) ([b7639cd](https://github.com/thenativeweb/validate-value/commit/b7639cd37aa48b1464faf9a373ab8fc7a3849181))
# [8.2.0](https://github.com/thenativeweb/validate-value/compare/8.1.1...8.2.0) (2020-11-12)

@@ -2,0 +9,0 @@

import Ajv from 'ajv';
import { getByDataPath } from './getByDataPath';
import { JSONSchema7 } from 'json-schema';

@@ -30,2 +31,3 @@ import { ValidationError } from './ValidationError';

const error = this.validateInternal.errors![0];
const failingValue = getByDataPath({ object: value, dataPath: error.dataPath });

@@ -54,2 +56,11 @@ let updatedPath = `${valueName}${error.dataPath.replace(/\//gu, separator)}`;

case 'minLength': {
const minPropertyLength = (error.params as Ajv.LimitParams).limit;
const actualLength = failingValue.length;
message = `String is too short (${actualLength} chars), minimum ${minPropertyLength}`;
break;
}
default: {

@@ -56,0 +67,0 @@ // Intentionally left blank.

4

package.json
{
"name": "validate-value",
"version": "8.2.0",
"version": "8.3.0",
"description": "validate-value validates values against JSON schemas.",

@@ -31,3 +31,3 @@ "contributors": [

"assertthat": "5.2.5",
"roboter": "11.5.7",
"roboter": "11.5.8",
"semantic-release-configuration": "1.0.25"

@@ -34,0 +34,0 @@ },

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