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

mustache-formats

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mustache-formats

Adds formatters to Mustache using Wax

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21
increased by90.91%
Maintainers
1
Weekly downloads
 
Created
Source

[![npm package][npm-badge]][npm]

mustache-formats

Add some useful formatters to Mustache using Mustache-Wax.

Installation

npm install mustache-formats

or

yarn add mustache-formats

Then to use it simply import it and call render, for example

const renderer = require('mustache-formats');

const result = renderer.render('Date: {{signature_date | date : "DD MMMM YYYY"}}', {
  signature_date: '2019-06-24T16:58:34'
});
// Expect result to be "Date: 24 June 2019"

Formats provided

In this first version, we've defined the following formats:

Date

Take a date (for example in ISO8601) and format it using Moment)

Usage:

{{projectInstallationDate | date : "DD MMMM YYYY" }}

Money

Convert to a number and ensure there are two decimal places

Usage:

{{total | money}}

Sum

Add any number of variables (or numbers) to an initial one. It ignores any that are null or undefined

Usage:

{{value_1 | sum : value_2 : value_3 : value_4}}

FAQs

Package last updated on 29 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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