0.0.5 • Published 8 years ago

hbs-helper v0.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

hbs helper

this repo list some hbs helpers.

maybe you will need it when you create the can.

default helpers

ifCond.js

if condition.

example:

    {{#ifCond v1 '>=' v2}}
        show when true
    {{/ifCond}}

please read the code to know more.

multiOr.js

compare multiple variable with 'or' condition

example:

    {{#multiOr var1 var2 var3 var4}}
        show text when one of var is true
    {{/multiOr}}

You can use as many variables as you can.

ifEven.js

Even

example:

  {{#each item}}
    {{#ifEven @index}}
        show if even
    {{/ifEven}}
  {{each}}

ifOdd.js

Odd

example:

  {{#each item}}
    {{#ifOdd @index}}
        show if even
    {{/ifOdd}}
  {{each}}

other helpers

gridValue.js

use to return the proper string based on the different length of array.

For example:

{{gridValue 1}} => "col-md-12 sm-col-12"
{{gridValue 5}} => "col-md-3 sm-col-6"

You can change the different grid value in your canner can.

gridValueKey.js

use to return the proper string based on the existing key.

For example:

now has these key-value => a: false, b: true, c: true

{{gridValueKey a b c}} => "col-md-6 sm-col-6" //cause the true key is b & c

You can change the different grid value in your canner can.