hmpo-template-mixins
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -32,4 +32,8 @@ 'use strict'; | ||
var viewEngine = options && options.viewEngine || 'html'; | ||
var sharedTranslationsKey = options && options.sharedTranslationsKey || 'shared'; | ||
var sharedTranslationsKey = options && options.sharedTranslationsKey || ''; | ||
if (sharedTranslationsKey && !sharedTranslationsKey.match(/\.$/)) { | ||
sharedTranslationsKey += '.'; | ||
} | ||
var PARTIALS = [ | ||
@@ -74,4 +78,4 @@ 'partials/forms/input-text-group', | ||
value: this.values && this.values[key], | ||
label: t(sharedTranslationsKey + '.fields.' + key + '.label'), | ||
hint: i18nLookup(sharedTranslationsKey + '.fields.' + key + '.hint'), | ||
label: t(sharedTranslationsKey + 'fields.' + key + '.label'), | ||
hint: i18nLookup(sharedTranslationsKey + 'fields.' + key + '.hint'), | ||
error: this.errors && this.errors[key], | ||
@@ -122,3 +126,3 @@ maxlength: extension.maxlength || maxlength(key), | ||
invalid: this.errors && this.errors[key] && opts.required, | ||
label: t(sharedTranslationsKey + '.fields.' + key + '.label'), | ||
label: t(sharedTranslationsKey + 'fields.' + key + '.label'), | ||
selected: selected | ||
@@ -217,3 +221,3 @@ }); | ||
return function (props) { | ||
props = props.split(' '); | ||
props = (props || '').split(' '); | ||
var def = 'next', | ||
@@ -224,3 +228,3 @@ value = props[0] || def, | ||
var obj = { | ||
value: t(sharedTranslationsKey + '.buttons.' + value), | ||
value: t(sharedTranslationsKey + 'buttons.' + value), | ||
id: id | ||
@@ -227,0 +231,0 @@ }; |
{ | ||
"name": "hmpo-template-mixins", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "A middleware that exposes a series of Mustache mixins on res.locals to ease usage of forms, translations, and some general needs.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "npm run lint", | ||
"lint": "./node_modules/.bin/eslint ." | ||
"test": "npm run lint && npm run unit", | ||
"lint": "eslint .", | ||
"unit": "mocha test/. --require ./test/helpers.js --recursive" | ||
}, | ||
@@ -36,4 +37,8 @@ "repository": { | ||
"devDependencies": { | ||
"eslint": "^0.14.1" | ||
"chai": "^2.1.0", | ||
"eslint": "^0.14.1", | ||
"mocha": "^2.1.0", | ||
"sinon": "^1.12.2", | ||
"sinon-chai": "^2.7.0" | ||
} | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
22304
17
393
5
1