Have ideas to improve npm?Join in the discussion! »

    handlebars-helper-ternary

    1.0.0 • Public • Published

    handlebars-helper-ternary

    A Handlebars ternary helper.

    npm Version Build Status Test Coverage Dependency Status

    Installation

    Install using npm:

    $ npm install handlebars-helper-ternary
    

    Usage

    helpers.js

    Example helpers file that requires in Handlebars and registers the ternary helper under the name "ternary".

    var Handlebars = require('handlebars');
     
    Handlebars.registerHelper('ternary', require('handlebars-helper-ternary'));

    templates/example.handlebars

    Example template file that makes use of the ternary helper. This helper accepts three arguments: a test argument to evaluate for truthiness, a yes argument to return in the case that test is truthy, and a no argument to return in the case that test is falsy.

    <button type="button">{{ternary isNew "Add" "Save"}}</button>
    

    Changelog

    1.0.0 - 2015-07-17

    • Initial release

    License

    MIT

    Install

    npm i handlebars-helper-ternary

    DownloadsWeekly Downloads

    196

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • avatar