Namespace: utils

utils

Utility functions

Namespaces

position
resizeScaling

Methods

staticGOWN.utils.mixin(destination, source){Object}

Mixin utility
Name Type Description
destination Object Destination object
source Object Source object
Returns:
Type Description
Object

staticGOWN.utils.roundDownToNearest(number, nearest){Number}

Rounds a Number down to the nearest multiple of an input. For example, by rounding 16 down to the nearest 10, you will receive 10. Similar to the built-in function Math.floor().
Name Type Description
number Number The number to round down
nearest Number The number whose multiple must be found
See:
  • Math#floor
Returns:
Type Description
Number The rounded number

staticGOWN.utils.roundToNearest(number, nearest){Number}

Rounds a Number up to the nearest multiple of an input. For example, by rounding 16 up to the nearest 10, you will receive 20. Similar to the built-in function Math.ceil().
Name Type Description
number Number The number to round up
nearest Number The number whose multiple must be found
See:
  • Math#ceil
Returns:
Type Description
Number The rounded number

staticGOWN.utils.roundToNearest(number, nearest){Number}

Rounds a Number to the nearest multiple of an input. For example, by rounding 16 to the nearest 10, you will receive 20. Similar to the built-in function Math.round().
Name Type Description
number Number The number to round
nearest Number The number whose multiple must be found
See:
  • Math#round
Returns:
Type Description
Number The rounded number

staticGOWN.utils.roundToPrecision(number, precision){Number}

Rounds a number to a certain level of precision. Useful for limiting the number of decimal places on a fractional number.
Name Type Description
number Number The input number to round
precision Number The number of decimal digits to keep
See:
  • Math#round
Returns:
Type Description
Number The rounded number, or the original input if no rounding is needed