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

@finnair/v-validation-moment

Package Overview
Dependencies
Maintainers
4
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.9.1 to 1.0.0

8

CHANGELOG.md

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

# [1.0.0](https://github.com/finnair/v-validation/compare/v0.9.1...v1.0.0) (2022-01-20)
**Note:** Version bump only for package @finnair/v-validation-moment
## [0.9.1](https://github.com/finnair/v-validation/compare/v0.9.0...v0.9.1) (2020-12-07)

@@ -8,0 +16,0 @@

2

dist/index.js

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

var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./Vmoment"), exports);

@@ -26,6 +26,6 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
if (v_validation_1.isNullOrUndefined(value)) {
if ((0, v_validation_1.isNullOrUndefined)(value)) {
return ctx.failure(v_validation_1.defaultViolations.notNull(path), value);
}
if (v_validation_1.isString(value) || moment_1.default.isMoment(value)) {
if ((0, v_validation_1.isString)(value) || moment_1.default.isMoment(value)) {
const convertedValue = this.parse(value);

@@ -45,6 +45,6 @@ if (convertedValue.isValid()) {

return __awaiter(this, void 0, void 0, function* () {
if (v_validation_1.isNullOrUndefined(value)) {
if ((0, v_validation_1.isNullOrUndefined)(value)) {
return ctx.failure(v_validation_1.defaultViolations.notNull(path), value);
}
if ((v_validation_1.isString(value) && durationPattern.test(value)) || moment_1.default.isDuration(value)) {
if (((0, v_validation_1.isString)(value) && durationPattern.test(value)) || moment_1.default.isDuration(value)) {
value = moment_1.default.duration(value);

@@ -61,7 +61,7 @@ if (value.isValid()) {

function maybeDateFormat(value, dateFormat) {
return v_validation_1.isString(value) ? dateFormat : undefined;
return (0, v_validation_1.isString)(value) ? dateFormat : undefined;
}
const dateFormat = 'YYYY-MM-DD';
function dateMoment(value) {
return Object.setPrototypeOf(moment_1.default(value, maybeDateFormat(value, dateFormat), true), dateMoment.prototype);
return Object.setPrototypeOf((0, moment_1.default)(value, maybeDateFormat(value, dateFormat), true), dateMoment.prototype);
}

@@ -68,0 +68,0 @@ exports.dateMoment = dateMoment;

{
"name": "@finnair/v-validation-moment",
"version": "0.9.1",
"version": "1.0.0",
"private": false,

@@ -28,7 +28,7 @@ "description": "Moment validators",

"dependencies": {
"@finnair/path": "^0.9.0",
"@finnair/v-validation": "^0.9.1",
"@finnair/path": "^1.0.0",
"@finnair/v-validation": "^1.0.0",
"moment": "2.27.0"
},
"gitHead": "3a3bea340e52e3c81c1caf6017d33e60c940c391"
"gitHead": "bd40a739be8c006e46f0b9f59426f435a971389b"
}
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