npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

justo.plugin.handlebars

v1.0.0-alpha3.0

Published

Justo plugin for the Handlebars template system.

Downloads

6

Readme

justo.plugin.handlebars

NPM version Total downloads

Justo plugin for the Handlebars template system.

Developed in Dogma, compiled to JavaScript.

Proudly made with ♥ in Valencia, Spain, EU.

Use

const hbs = require("justo.plugin.handlebars");

hbs.render task

This task renders a Handlebars template:

render({model, tmpl, src, dst}) : string
  • model (object, required). Data object to use.
  • tmpl (string). Template text to render.
  • src (string). Template file to render.
  • dst (string). File to generate if needed.

At least, src or tmpl must be specified.

Example:

hbs.render({
  model: {name: "France 24", website: "france24.com"},
  src: "tv.hbs",
  dst: "france24.json"
});

Available helpers

The following built-in helpers can be used.

{{and}}

This helper performs a logical AND:

{{and exp exp...}}

{{or}}

This helper performs a logical OR:

{{or exp exp...}}

{{http}}

This helper returns a text with a HTTP or HTTPS url:

{{http url}}

{{in}}

This helper checks whether an item is in a collection:

{{in value collection}}
{{in value item1 item2 item3...}}

{{nin}}

This helper checks whether an item is not in a collection:

{{nin value collection}}
{{nin value item1 item2 item3...}}

{{like}}

This helper checks a value is like a pattern:

{{like value pattern}}

{{len}}

This helper returns the length of a collection:

{{len collection}}

{{includes}}

This helper checks whether a collection has an item:

{{includes collection item}}

{{esc}}

This helper escapes a text:

{{esc text}}

{{lowercase}}

This helper returns a text in lowercase:

{{lowercase text}}

{{uppercase}}

This helper returns a text in uppercase:

{{uppercase text}}

{{capitalize}}

This helper returns a text capitalized:

{{capitalize text}}

{{concat}}

This helper returns the concatenation of multiple texts:

{{concat text1 text2...}}

{{replace}}

This helper returns a text with a subtext replaced:

{{replace text old}}
{{replace text old new}}

When no new specified, the old text is removed; similar to {{replace text old ""}}.

{{true}}

This helper checks whether a value is true, "true" or "yes":

{{true value}}

{{false}}

This helper checks whether a value is false, "false" or "no":

{{false value}}

{{eq}}

This helper checks whether two values are equal:

{{eq value1 value2}}

{{ne}}

This helper checks whether two values are different:

{{ne value1 value2}}

{{lt}}

This helper checks whether a value is less than another:

{{lt value1 value2}}

{{le}}

This helper checks whether a value is less than or equal to another:

{{le value1 value2}}

{{gt}}

This helper checks whether a value is greater than another:

{{gt value1 value2}}

{{ge}}

This helper checks whether a value is greater than or equal to another:

{{ge value1 value2}}

{{iif}}

This helper is similar to cond ? value1 : value2:

{{iif cond value1 value2}}

{{coalesce}}

This helper returns the first value not null:

{{coalesce value1 value2 value3...}}