## Functions
Takes an HTML width/size string and performs a calcuation against it. This would be used to dynamically size an attribute for inline styles in a React component (e.g.). It uses four basic operations (addition, subtraction multiplication, and division).
e.g.
taking "20px" and doubling its size => calc('20px', '* 2'); // '40px'
Takes an input sizing value as a px value and converts it to an equivalent "em" value. It divides the size of the input value by the given font size.
Takes an input sizing value as a px value and converts it to an equivalent "rem" value. It divides the size of the input value by the given font size.
Converts a unit type number (16px) to its number counterpart (16). It
will check if a number exists. If the input is not a number, then an
exception is thrown. This function will handle: "em, pc, pt, px, rem"
units.
string | number - the value that will be modified. This is a
number or a string representing a number.
- oper string - the operation that will be applied to the text number
## toEM(inp, fontSize, precision) ⇒
Takes an input sizing value as a px value and converts it to an
equivalent "em" value. It divides the size of the input value
by the given font size.
**Kind**: global function
**Returns**: the new "em" conversion value.
**Params**
- inp string | number - the value that will be modified. This is a
number or a string representing a number as a "##px" value.
- fontSize number = 16 - the pixel height of the font used in this
calculation.
- precision number = 3 - the maximum number of decimal places returned
by the calculation
## toREM(inp, fontSize, precision) ⇒
Takes an input sizing value as a px value and converts it to an
equivalent "rem" value. It divides the size of the input value
by the given font size.
**Kind**: global function
**Returns**: the new "rem" conversion value.
**Params**
- inp string | number - the value that will be modified. This is a number
or a string representing a number as a "##px" value.
- fontSize number = 16 - the pixel height of the font used in this
calculation.
- precision number = 3 - the maximum number of decimal places returned
by the calculation
## unitToNumber(inp) ⇒
Converts a unit type number (`16px`) to its number counterpart (`16`). It
will check if a number exists. If the input is not a number, then an
exception is thrown. This function will handle: "em, pc, pt, px, rem"
units.
**Kind**: global function
**Returns**: the number component of the unit value.
**Params**
- inp string - the unit number string to convert.