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.8 to 0.1.9

5

lib/template-mixins.js

@@ -263,4 +263,5 @@ 'use strict';

return function (txt) {
var value = Hogan.compile(txt).render(this);
return moment(value).format('D MMMM YYYY');
txt = (txt || '').split('|');
var value = Hogan.compile(txt[0]).render(this);
return moment(value).format(txt[1] || 'D MMMM YYYY');
};

@@ -267,0 +268,0 @@ };

2

package.json
{
"name": "hmpo-template-mixins",
"version": "0.1.8",
"version": "0.1.9",
"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",

@@ -199,2 +199,30 @@ var mixins = require('../lib/template-mixins');

describe('date', function () {
beforeEach(function () {
middleware = mixins(translate, {});
});
it('adds a function to res.locals', function () {
middleware(req, res, next);
res.locals['date'].should.be.a('function');
});
it('returns a function', function () {
middleware(req, res, next);
res.locals['date']().should.be.a('function');
});
it('formats a date', function () {
middleware(req, res, next);
res.locals['date']().call(res.locals, '2015-03-26').should.equal('26 March 2015');
});
it('applys a date format if specified', function () {
middleware(req, res, next);
res.locals['date']().call(res.locals, '2015-03|MMMM YYYY').should.equal('March 2015');
});
});
});
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