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

yaschema

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaschema - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

28

lib/schema/data-types/array.js

@@ -108,18 +108,16 @@ "use strict";

let errorResult;
if (validatorOptions.validation !== 'none') {
if (errorResult === undefined && value.length < minLength) {
errorResult = {
error: () => `Expected an array with at least ${minLength} element(s), found an array with ${value.length} element(s)${(0, path_utils_1.atPath)(path)}`
};
if (shouldStopOnFirstError) {
return errorResult;
}
if (errorResult === undefined && value.length < minLength) {
errorResult = {
error: () => `Expected an array with at least ${minLength} element(s), found an array with ${value.length} element(s)${(0, path_utils_1.atPath)(path)}`
};
if (shouldStopOnFirstError) {
return errorResult;
}
if (errorResult === undefined && maxLength !== undefined && value.length > maxLength) {
errorResult = {
error: () => `Expected an array with at most ${maxLength} element(s), found an array with ${value.length} element(s)${(0, path_utils_1.atPath)(path)}`
};
if (shouldStopOnFirstError) {
return errorResult;
}
}
if (errorResult === undefined && maxLength !== undefined && value.length > maxLength) {
errorResult = {
error: () => `Expected an array with at most ${maxLength} element(s), found an array with ${value.length} element(s)${(0, path_utils_1.atPath)(path)}`
};
if (shouldStopOnFirstError) {
return errorResult;
}

@@ -126,0 +124,0 @@ }

@@ -69,5 +69,2 @@ "use strict";

const validateSerializedForm = (value, validatorOptions, path) => {
if (validatorOptions.validation === 'none') {
return consts_1.noError;
}
const validation = serDes.serializedSchema().internalValidate(value, validatorOptions, path);

@@ -74,0 +71,0 @@ if (validation.error !== undefined) {

@@ -1,2 +0,2 @@

import { Range } from '../../types/range';
import type { Range } from '../../types/range';
import type { Schema } from '../../types/schema';

@@ -3,0 +3,0 @@ /** Requires a `Date`, which will be serialized as an ISO Date/Time string */

import type { PureSchema } from '../../types/pure-schema';
import type { SchemaFunctions } from '../../types/schema-functions';
import type { InternalSchemaFunctions } from './types/internal-schema-functions';
import { InternalAsyncValidator, InternalValidator } from './types/internal-validation';
import type { InternalAsyncValidator, InternalValidator } from './types/internal-validation';
/** This is the same as the public schema interface except that the internal validation methods are exposed and that properties added on top

@@ -6,0 +6,0 @@ * of `PureSchema<ValueT>` are directly exposed */

@@ -1,2 +0,2 @@

import { ValidationMode } from '../../../types/validation-options';
import type { ValidationMode } from '../../../types/validation-options';
/**

@@ -3,0 +3,0 @@ * - `'none'` - No transformation is performed (used for validation)

@@ -1,2 +0,2 @@

import { Range } from '../../../types/range';
import type { Range } from '../../../types/range';
export declare const validateValueInRange: <T extends number | Date>(value: T, { allowed, path }: {

@@ -3,0 +3,0 @@ allowed: Range<T>[];

@@ -77,4 +77,5 @@ "use strict";

}
const asyncTimeComplexityThreshold = (0, async_time_complexity_threshold_1.getAsyncTimeComplexityThreshold)();
const validationResults = [];
const asyncTimeComplexityThreshold = (0, async_time_complexity_threshold_1.getAsyncTimeComplexityThreshold)();
let success = false;
for (const schema of schemas) {

@@ -85,3 +86,6 @@ const result = schema.estimatedValidationTimeComplexity > asyncTimeComplexityThreshold

if (result.error === undefined) {
return consts_1.noError;
success = true;
if (!needsDeepSerDes) {
return consts_1.noError;
}
}

@@ -92,6 +96,8 @@ else {

}
return {
error: () => `Expected one of: ${validationResults.map((r) => r.error()).join(' or ')}, found ${(0, get_meaningful_typeof_1.getMeaningfulTypeof)(value)}${(0, path_utils_1.atPath)(path)}`
};
return success
? consts_1.noError
: {
error: () => `Expected one of: ${validationResults.map((r) => r.error()).join(' or ')}, found ${(0, get_meaningful_typeof_1.getMeaningfulTypeof)(value)}${(0, path_utils_1.atPath)(path)}`
};
});
//# sourceMappingURL=one-of.js.map
import type { TransformationOptions } from './transformation-options';
import { ValidationOptions } from './validation-options';
import type { ValidationOptions } from './validation-options';
/** If error is undefined, the result is a success. Otherwise, there was a problem. */

@@ -4,0 +4,0 @@ export declare type DeserializationResult<T> = {

import type { JsonValue } from './json-value';
import type { TransformationOptions } from './transformation-options';
import { ValidationOptions } from './validation-options';
import type { ValidationOptions } from './validation-options';
/** If error is undefined, the result is a success. Otherwise, there was a problem. */

@@ -5,0 +5,0 @@ export declare type SerializationResult = {

{
"name": "yaschema",
"version": "1.4.0",
"version": "1.4.1",
"description": "Yet another schema",

@@ -5,0 +5,0 @@ "keywords": [

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

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