Math Helper

Helper Description
add Calculates the sum of two numbers.
sub Calculates the difference of the given values.
multiply Calculate the multiplication of the given values.
divide Compute the division of the given values.
ceil Round up the value.
floor Rounds down a number.
abs Returns an absolute value.

add

Calculates the sum of two numbers.
Parameters:
  • val1: number|string
    The first number.
  • val2: number|string
    The second number.
          // results in: 3
hbs.compile("{{add a b}}")({"a":1,"b":2});
        

sub

Calculates the difference of the given values.
Parameters:
  • val1: number|string
    The first number.
  • val2: number|string
    The second number.
          // results in: 3
hbs.compile("{{sub a b}}")({"a":5,"b":2});
        

multiply

Calculate the multiplication of the given values.
Parameters:
  • val1: number|string
    The first number.
  • val2: number|string
    The second number.
          // results in: 10
hbs.compile("{{multiply a b}}")({"a":5,"b":2});
        

divide

Compute the division of the given values.
Parameters:
  • val1: number|string
    The first number.
  • val2: number|string
    The second number.
          // results in: 5
hbs.compile("{{divide a b}}")({"a":10,"b":2});
        

ceil

Round up the value.
Parameters:
  • val: number|string
    Number to be rounded to nearest greater integer.
          // results in: 6
hbs.compile("{{ceil a}}")({"a":5.6});
        

floor

Rounds down a number.
Parameters:
  • val: number|string
    Number to be rounded to nearest lower integer.
          // results in: 5
hbs.compile("{{floor a}}")({"a":5.6});
        

abs

Returns an absolute value.
Parameters:
  • val: number|string
    Number to perform absolute value operation on.
          // results in: 5.6
hbs.compile("{{abs a b}}")({"a":-5.6});