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

@finnair/v-validation-luxon

Package Overview
Dependencies
Maintainers
4
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finnair/v-validation-luxon - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0-alpha.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [3.0.0-alpha.0](https://github.com/finnair/v-validation/compare/v2.0.0...v3.0.0-alpha.0) (2022-09-26)
### Features
* Use SyncPromise also in schema and luxon ([e8590b8](https://github.com/finnair/v-validation/commit/e8590b8c2a44ad28fde88f8682f53628ecf74a0f))
# [2.0.0](https://github.com/finnair/v-validation/compare/v1.1.0...v2.0.0) (2022-09-08)

@@ -8,0 +19,0 @@

2

dist/Vluxon.d.ts

@@ -15,3 +15,3 @@ import { ValidationContext, Validator, ValidationResult } from '@finnair/v-validation';

}
export declare function validateLuxon({ value, path, ctx, type, proto, pattern, parser }: ValidateLuxonParams): Promise<ValidationResult>;
export declare function validateLuxon({ value, path, ctx, type, proto, pattern, parser }: ValidateLuxonParams): PromiseLike<ValidationResult>;
declare function localDate(options?: DateTimeOptions): import("@finnair/v-validation").ValidatorFnWrapper;

@@ -18,0 +18,0 @@ declare function localTime(options?: DateTimeOptions): import("@finnair/v-validation").ValidatorFnWrapper;

@@ -17,28 +17,26 @@ "use strict";

function validateLuxon({ value, path, ctx, type, proto, pattern, parser }) {
return __awaiter(this, void 0, void 0, function* () {
if ((0, v_validation_1.isNullOrUndefined)(value)) {
return ctx.failure(v_validation_1.defaultViolations.notNull(path), value);
if ((0, v_validation_1.isNullOrUndefined)(value)) {
return ctx.failurePromise(v_validation_1.defaultViolations.notNull(path), value);
}
if (proto && value instanceof proto) {
return ctx.successPromise(value);
}
else if (luxon_1.DateTime.isDateTime(value)) {
if (value.isValid) {
return success(value);
}
if (proto && value instanceof proto) {
return ctx.success(value);
}
else if (luxon_1.DateTime.isDateTime(value)) {
if (value.isValid) {
return success(value);
}
else if ((0, v_validation_1.isString)(value)) {
const match = pattern.exec(value);
if (match) {
const dateTime = parser(value, match);
if (dateTime.isValid) {
return success(dateTime);
}
}
else if ((0, v_validation_1.isString)(value)) {
const match = pattern.exec(value);
if (match) {
const dateTime = parser(value, match);
if (dateTime.isValid) {
return success(dateTime);
}
}
}
return ctx.failure(v_validation_1.defaultViolations.date(value, path, type), value);
function success(dateTime) {
return ctx.success(proto ? new proto(dateTime) : dateTime);
}
});
}
return ctx.failurePromise(v_validation_1.defaultViolations.date(value, path, type), value);
function success(dateTime) {
return ctx.successPromise(proto ? new proto(dateTime) : dateTime);
}
}

@@ -45,0 +43,0 @@ exports.validateLuxon = validateLuxon;

{
"name": "@finnair/v-validation-luxon",
"version": "2.0.0",
"version": "3.0.0-alpha.0",
"private": false,

@@ -29,3 +29,3 @@ "description": "Luxon validators",

"@finnair/path": "^2.0.0",
"@finnair/v-validation": "^2.0.0",
"@finnair/v-validation": "^3.0.0-alpha.0",
"luxon": "3.0.3"

@@ -36,3 +36,3 @@ },

},
"gitHead": "432759665b664859d5ed80e4b573432abdb23afc"
"gitHead": "f41f76dbe0365314dc15c07d3db2ad5a7b5e4109"
}
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