Math Helpers

Allows performing simple math

Math Helpers

{{abs}}

Return the magnitude of a.

Params

  • a {Number}
  • returns {Number}

{{add}}

Return the sum of a plus b.

Params

  • a {Number}
  • b {Number}
  • returns {Number}

{{avg}}

Returns the average of all numbers in the given array.

Params

  • array {Array}: Array of numbers to add up.
  • returns {Number}

Example

{{avg "[1, 2, 3, 4, 5]"}}
<!-- results in: '3' -->

{{ceil}}

Get the Math.ceil() of the given value.

Params

  • value {Number}
  • returns {Number}

{{divide}}

Divide a by b

Params

  • a {Number}: numerator
  • b {Number}: denominator

{{floor}}

Get the Math.floor() of the given value.

Params

  • value {Number}
  • returns {Number}

{{minus}}

Return the difference of a minus b.

Params

  • a {Number}
  • b {Number}

{{modulo}}

Get the remainder of a division operation.

Params

  • a {Number}
  • b {Number}
  • returns {Number}

{{multiply}}

Return the product of a times b.

Params

  • a {Number}: factor
  • b {Number}: multiplier
  • returns {Number}

{{plus}}

Add a by b.

Params

  • a {Number}: factor
  • b {Number}: multiplier

{{random}}

Generate a random number between two values

Params

  • min {Number}
  • max {Number}
  • returns {String}

{{remainder}}

Get the remainder when a is divided by b.

Params

  • a {Number}: a
  • b {Number}: b

{{round}}

Round the given number.

Params

  • number {Number}
  • returns {Number}

{{subtract}}

Return the product of a minus b.

Params

  • a {Number}
  • b {Number}
  • returns {Number}

{{sum}}

Returns the sum of all numbers in the given array.

Params

  • array {Array}: Array of numbers to add up.
  • returns {Number}

Example

{{sum "[1, 2, 3, 4, 5]"}}
<!-- results in: '15' -->

{{times}}

Multiply number a by number b.

Params

  • a {Number}: factor
  • b {Number}: multiplier
  • returns {Number}


Still require support?
Write to us: templr @ siavak . com
© Copyright 2021. All rights reserved.
Powered by Siavak