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

hmpo-template-mixins

Package Overview
Dependencies
Maintainers
3
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hmpo-template-mixins - npm Package Compare versions

Comparing version 7.5.0 to 7.5.1

9

lib/mixins/date.js

@@ -54,8 +54,9 @@ 'use strict';

if (err) return callback(err);
let errorValues = req.sessionModel.get('errorValues') || {};
req.form.options.dateFields.forEach(fieldName => {
if (!values[fieldName]) return;
let date = values[fieldName].split('-');
values[fieldName + '-day'] = values[fieldName + '-day-raw'] || date[2];
values[fieldName + '-month'] = values[fieldName + '-month-raw'] || date[1];
values[fieldName + '-year'] = values[fieldName + '-year-raw'] || date[0];
let [year, month, day] = values[fieldName].split('-');
values[fieldName + '-day'] = errorValues[fieldName + '-day-raw'] || day;
values[fieldName + '-month'] = errorValues[fieldName + '-month-raw'] || month;
values[fieldName + '-year'] = errorValues[fieldName + '-year-raw'] || year;
});

@@ -62,0 +63,0 @@ callback(null, values);

{
"name": "hmpo-template-mixins",
"version": "7.5.0",
"version": "7.5.1",
"description": "A middleware that exposes a series of Mustache mixins on res.locals to ease usage of forms, translations, and some general needs.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -41,2 +41,5 @@ 'use strict';

options
},
sessionModel: {
get: sinon.stub()
}

@@ -155,2 +158,3 @@ };

it('should parse out date values if no raw values are present', () => {
req.sessionModel.get.withArgs('errorValues').returns(undefined);
instance.getValues(req, res, callback);

@@ -170,5 +174,3 @@ callback.should.have.been.calledWithExactly(null, {

it('should use raw values if present instead of using date values', () => {
options.dateFields = ['date1'];
BaseController.prototype.getValues.yields(null, {
'date1': '1980-04-23',
req.sessionModel.get.withArgs('errorValues').returns({
'date1-day-raw': '1',

@@ -178,2 +180,6 @@ 'date1-month-raw': '1',

});
options.dateFields = ['date1'];
BaseController.prototype.getValues.yields(null, {
'date1': '1980-04-23',
});
instance.getValues(req, res, callback);

@@ -185,5 +191,2 @@ callback.should.have.been.calledWithExactly(null, {

'date1-year': '1900',
'date1-day-raw': '1',
'date1-month-raw': '1',
'date1-year-raw': '1900'
});

@@ -190,0 +193,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