Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

handlebars-helpers-underscore.string

1.1.0 • Public • Published

Build Status Coverage Status Code Climate Dependency Status devDependency Status Downloads

handlebars-helpers-underscore.string

Wrap underscore.string functions to Handlebars helpers

Installation

Via bower:

bower install handlebars-helpers-underscore.string

Via npm:

npm install handlebars-helpers-underscore.string

Usage

In node:

Handlebars = require('handlebars');
require('handlebars-helpers-underscore.string');
 
var source = "<p>Hello, my name is {{name}}. I am from {{underscored hometown}}. I have " +
             "{{kids.length}} kids:</p>" +
             "<ul>{{#kids}}<li>{{name}} is {{age}}</li>{{/kids}}</ul>";
var template = Handlebars.compile(source);
 
var data = { "name": "Alan", "hometown": "Somewhere, TX",
             "kids": [{"name": "Jimmy", "age": "12"}, {"name": "Sally", "age": "4"}]};
var result = template(data);
 
// Would render:
// <p>Hello, my name is Alan. I am from somewhere,_tx. I have 2 kids:</p>
// <ul>
//   <li>Jimmy is 12</li>
//   <li>Sally is 4</li>
// </ul>

In webpack remember to set node.fs to empty.

Install

npm i handlebars-helpers-underscore.string

DownloadsWeekly Downloads

7

Version

1.1.0

License

MIT

Last publish

Collaborators

  • avatar