You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
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

to
6.1.2

17

lib/mixins/date.js

@@ -119,3 +119,3 @@ 'use strict';

if (numericErrors) {
let errorType = 'date';
let errorType = 'date-numeric';
if (errors[fieldName + '-year']) errorType += '-year';

@@ -139,12 +139,7 @@ if (errors[fieldName + '-month']) errorType += '-month';

if (invalidElement) {
errors[fieldName] = new this.Error(
fieldName,
{ type: 'date-invalid-' + invalidElement },
req
);
errors[fieldName + '-' + invalidElement] = new this.Error(
fieldName + '-' + invalidElement,
{ type: 'date-invalid-' + invalidElement, errorGroup: fieldName },
req
);
let error = { type: 'date-' + invalidElement, errorGroup: fieldName };
errors[fieldName] =
new this.Error(fieldName, error, req);
errors[fieldName + '-' + invalidElement] =
new this.Error(fieldName + '-' + invalidElement, error, req);
}

@@ -151,0 +146,0 @@ }

@@ -167,3 +167,4 @@ 'use strict';

function errorGroup(key) {
function errorGroup(key, options) {
options = options || {};
var field = getFieldConfig(this.options.fields, key);

@@ -185,7 +186,6 @@ var legend = field.legend;

legend: t(legendValue),
legendClassName: legendClassName,
legendClassName: legendClassName || legendClassName,
hint: conditionalTranslate(getTranslationKey(field, key, 'hint')),
groupAttributes: field.groupAttributes,
groupClassName: field.groupClassName,
className: classNames(field)
groupClassName: field.groupClassName || options.groupClassName
};

@@ -225,3 +225,7 @@ }

this.errors[key] ||
(this.errors[field.errorGroup] && !this.errors[field.errorGroup].errorGroup && this.errors[field.errorGroup])
(
field.errorGroup &&
this.errors[field.errorGroup] &&
!this.errors[field.errorGroup].errorGroup
)
);

@@ -445,3 +449,3 @@

path: 'partials/forms/error-group-end',
renderWith: errorGroup
renderWith: function () { return {}; }
},

@@ -493,4 +497,8 @@ 'input-date': {

return function (key) {
var options = {
groupClassName: 'form-date',
legendClassName: 'form-label-bold'
};
var parts = [
res.locals['error-group']().call(this, key),
res.locals['error-group']().call(this, key, options),
res.locals['input-date']().call(this, key),

@@ -497,0 +505,0 @@ res.locals['error-group-end']().call(this, key)

{
"name": "hmpo-template-mixins",
"version": "6.1.1",
"version": "6.1.2",
"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",

@@ -369,3 +369,3 @@ 'use strict';

errors['date1'].type.should.equal('date-day');
errors['date1'].type.should.equal('date-numeric-day');
});

@@ -382,3 +382,3 @@

errors['date1'].type.should.equal('date-month');
errors['date1'].type.should.equal('date-numeric-month');
});

@@ -397,3 +397,3 @@

errors['date1'].type.should.equal('date-year-month-day');
errors['date1'].type.should.equal('date-numeric-year-month-day');
});

@@ -422,7 +422,7 @@

'date1',
{ type: 'date-invalid-day' },
{ type: 'date-day', errorGroup: 'date1' },
req));
errors['date1-day'].should.eql(new instance.Error(
'date1-day',
{ type: 'date-invalid-day', errorGroup: 'date1' },
{ type: 'date-day', errorGroup: 'date1' },
req));

@@ -438,7 +438,7 @@ });

'date1',
{ type: 'date-invalid-day' },
{ type: 'date-day', errorGroup: 'date1' },
req));
errors['date1-day'].should.eql(new instance.Error(
'date1-day',
{ type: 'date-invalid-day', errorGroup: 'date1' },
{ type: 'date-day', errorGroup: 'date1' },
req));

@@ -454,7 +454,7 @@ });

'date1',
{ type: 'date-invalid-month' },
{ type: 'date-month', errorGroup: 'date1' },
req));
errors['date1-month'].should.eql(new instance.Error(
'date1-month',
{ type: 'date-invalid-month', errorGroup: 'date1' },
{ type: 'date-month', errorGroup: 'date1' },
req));

@@ -461,0 +461,0 @@ });

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 too big to display