From cb942f87cad203404fd6765fbb4187ce1a63fe99 Mon Sep 17 00:00:00 2001 From: Piyush Dixit <79581397+PiyushDixit96@users.noreply.github.com> Date: Sun, 16 May 2021 15:17:48 +0530 Subject: add trim func --- index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0ff0018..01e0cf1 100644 --- a/index.js +++ b/index.js @@ -66,8 +66,8 @@ function process_data(data) { l: lastTradeQuantity, z: Cumulative_filled_quantity } = data; - let str4 = symbol.slice(symbol.length - 4); - let str3 = symbol.slice(symbol.length - 3); + let str4 = Trim(symbol,4)//symbol.slice(symbol.length - 4); + let str3 = Trim(symbol,3)//symbol.slice(symbol.length - 3); let sy; if(["USDT", "BUSD", "TUSD", "USDC", "BIDR", "IDRT", "BVND"].includes(str4)) { sy = str4 @@ -141,3 +141,9 @@ function sendMessage(text) { throw error; }); } + +function Trim(input, last_n_chr) { + if (!input || !input.length) { return; } + //last_n_chr = +last_n_chr; //parse to int + return input.slice(last_n_chr); +} -- cgit v1.2.3