New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 0.1.2 to 0.1.3

27

lib/i18n-property.js
'use strict';
var _ = require('underscore'),
var lookup = require('i18n-lookup'),
Hogan = require('hogan.js');

@@ -10,24 +10,5 @@

module.exports = function (t) {
/**
* Given an array of keys and a context iterate through
* each of the keys until (1) the translated key is different
* from the non-translated key, and (2) a template containing the
* data from the context compiles successfully.
*/
return function (keys, context) {
if (typeof keys === 'string') {
keys = [keys];
}
return _.reduce(keys, function (message, token) {
if (!message && t(token) !== token) {
try {
message = Hogan.compile(t(token)).render(context || {});
} catch (e) {}
}
return message;
}, null);
};
return lookup(t, function (template, context) {
return Hogan.compile(template).render(context);
});
};

3

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

@@ -33,2 +33,3 @@ "main": "index.js",

"hogan.js": "^3.0.2",
"i18n-lookup": "^0.1.0",
"moment": "^2.9.0",

@@ -35,0 +36,0 @@ "underscore": "^1.7.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