[refactor] Moved 'roundToTwo' to its own TS file

This commit is contained in:
Steven Evans
2018-07-04 20:22:29 -04:00
parent e16ca2abb5
commit 39c9488768
4 changed files with 13 additions and 10 deletions
+9
View File
@@ -0,0 +1,9 @@
/**
* Rounds a number to two decimal places.
* @param decimal A decimal value to trim to two places.
*/
export function roundToTwo(decimal: number) {
const leftShift: number = Math.round(parseInt(`${decimal}e+2`, 10));
return +(`${leftShift}e-2`);
}