From 6f682aadaffd633c364d50ef5e11b14c1dbc7256 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 17 May 2016 16:16:37 -0400 Subject: [PATCH] convert M to 1000000 --- public/bot.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/bot.js b/public/bot.js index 6342eeb..3aaaf72 100644 --- a/public/bot.js +++ b/public/bot.js @@ -350,7 +350,11 @@ function haveTrillions(number) { } function convertToNumber(string) { - return Number(string.replace(/[^0-9\.]+/g, '')); + if(string.indexOf('M') > -1) { + return Number(string.replace(/[^0-9\.]+/g, '')) * 1000000; + } else { + return Number(string.replace(/[^0-9\.]+/g, '')); + } } function trillions(number) {