ember-math-fns

1.4.1 • Public • Published

ember-math-fns npm version Build Status codecov

This addon provides math helpers for Ember templates and components.

To install:

ember install ember-math-fns

Usage

math-abs

Determines the absolute value of a number. See Math.abs() for details on the Math.abs function.

{{math-abs -22}}
{{math-abs difference}}

math-add

Adds two or more numbers together.

{{math-add 1 2}}
{{math-add 1 2 3 5 8 13 21}}
{{math-add total tax}}

math-ceil

Rounds a number up to the nearest integer. See Math.ceil() for details on the Math.ceil function.

{{math-ceil 3.24}}
{{math-ceil giving}}

math-decrement

Decrement a value by 1.

{{math-decrement 10}}
{{math-decrement counter}}

math-divide

Divides two or more numbers from left to right.

{{math-divide 20 5}}
{{math-divide 100 10 5}}
{{math-divide paycheck wives}}

math-eq

Determines if two or more numbers are equal.

{{math-eq 20 5}}
{{math-eq 100 10 5}}
{{math-eq paycheck taxes}}

math-floor

Rounds a numbe down to the nearest integer. See Math.fllor() for details on the Math.fllor function.

{{math-floor 4.54}}
{{math-floor tax}}

math-gt

Determines if two or more numbers are greater than each other from left to right.

{{math-gt 20 5}}
{{math-gt 100 10 5}}
{{math-gt paycheck taxes}}

math-gte

Determines if two or more numbers are greater than or equal to each other from left to right.

{{math-gte 20 5}}
{{math-gte 10 10 5}}
{{math-gte paycheck taxes}}

math-increment

Increment a value by 1.

{{math-increment 0}}
{{math-increment counter}}

math-lt

Determines if two or more numbers are less than each other from left to right.

{{math-lt 5 20}}
{{math-lt 5 10 100}}
{{math-lt paycheck taxes}}

math-lte

Determines if two or more numbers are less than or equal to each other from left to right.

{{math-lte 5 20}}
{{math-lte 5 10 10}}
{{math-lte paycheck taxes}}

math-max

Determines the largest of two or more numbers. See Math.max() for details on the Math.max function.

{{math-max 17 22}}
{{math-max 4 3 29 4}}
{{math-max paycheck federalTaxes stateTaxes}}

math-min

Determines the smallest of two or more numbers. See Math.min() for details on the Math.min function.

{{math-min -22 8}}
{{math-min 14 23 11}}
{{math-min numberOfJiras timeInDay}}

math-mod

Perform the modulus of a value and its divisor to get the remainder.

{{math-mod 12 3}}
{{math-mod value divisor}}

math-multiply

Multiplies two or more numbers together.

{{math-multiply 4 5}}
{{math-multiply 11 10 2}}
{{math-multiply children costOfCollege}}

math-ne

Determines if two or more numbers are not equal.

{{math-ne 20 5}}
{{math-ne 100 10 5}}
{{math-ne tip tax}}

math-negate

Negate/invert the sign for a number.

{{math-negate 2}}
{{math-negate value}}

math-pow

Returns the result of a number to the power of the other. See Math.pow() for details on the Math.pow function.

{{math-pow 3 4}}
{{math-pow bugs numberOfCustomers}}

math-random

Returns a random decimal number between 0 and 1. See Math.random() for details on the Math.random function.

{{math-random}}

math-round

Round a number to the nearest integer. See Math.round() for details on the Math.round function.

{{math-round 14.5}}
{{math-round difference}}

math-sign

Return a -1 for a negative number and positive 1 for positive numbers. See Math.sign() for details on the Math.sign function.

{{math-sign -19}}
{{math-sign difference}}

math-subtract

Subtract two or more numbers from left to right.

{{math-subtract 3 2}}
{{math-subtract 100 10 9}}
{{math-subtract paycheck rent}}

Related Addons

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v2.13 or above
  • Node.js v8 or above

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i ember-math-fns

Weekly Downloads

1

Version

1.4.1

License

MIT

Unpacked Size

23.9 kB

Total Files

54

Last publish

Collaborators

  • robert.allan.frank