From 618c4f1a984613dc870e68606d0f8ee02df90814 Mon Sep 17 00:00:00 2001 From: Severiano Badajoz Date: Thu, 28 May 2020 15:55:50 -0700 Subject: [PATCH] fix bugs w/ abs/floor --- client/src/components/util/truncate.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/components/util/truncate.js b/client/src/components/util/truncate.js index 33067154..c9708e54 100644 --- a/client/src/components/util/truncate.js +++ b/client/src/components/util/truncate.js @@ -48,8 +48,8 @@ export default class Truncate extends Component { maxSize, params, length < lastLength - ? length / 2 - : Math.floor(Math.floor((length - lastLength) / 2) + lastLength), + ? Math.floor(length / 2) + : Math.floor(Math.abs(length - lastLength) / 2) + lastLength, length, close ); @@ -63,7 +63,7 @@ export default class Truncate extends Component { str, maxSize, params, - Math.floor((lastLength - length) / 2) + length, + Math.floor(Math.abs(lastLength - length) / 2) + length, length, close );