UNPKG

hbs-helper

Version:

handlebar template engine's helper

89 lines (55 loc) 1.32 kB
# 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: ```hbs {{#ifCond v1 '>=' v2}} show when true {{/ifCond}} ``` please read the code to know more. ### multiOr.js compare multiple variable with 'or' condition example: ```hbs {{#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: ```hbs {{#each item}} {{#ifEven @index}} show if even {{/ifEven}} {{each}} ``` ### ifOdd.js Odd example: ```hbs {{#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.