From be5137ba0b102decc75380bb88461e0f57b193fa Mon Sep 17 00:00:00 2001 From: noumantahir Date: Wed, 25 Aug 2021 14:00:14 +0500 Subject: [PATCH] removed unused reputation methods --- src/utils/authorReputation.js | 34 --------------------------------- src/utils/reputation.js | 36 ----------------------------------- 2 files changed, 70 deletions(-) delete mode 100644 src/utils/authorReputation.js delete mode 100644 src/utils/reputation.js diff --git a/src/utils/authorReputation.js b/src/utils/authorReputation.js deleted file mode 100644 index 36ee769cb..000000000 --- a/src/utils/authorReputation.js +++ /dev/null @@ -1,34 +0,0 @@ -export default (input) => { - if (!input) { - return 0; - } - - if (input === 0) { - return 25; - } - - if (!input) { - return input; - } - - let neg = false; - - if (input < 0) { - neg = true; - } - - let reputationLevel = Math.log10(Math.abs(input)); - reputationLevel = Math.max(reputationLevel - 9, 0); - - if (reputationLevel < 0) { - reputationLevel = 0; - } - - if (neg) { - reputationLevel *= -1; - } - - reputationLevel = reputationLevel * 9 + 25; - - return Math.floor(reputationLevel); -}; diff --git a/src/utils/reputation.js b/src/utils/reputation.js deleted file mode 100644 index 58e86f0c2..000000000 --- a/src/utils/reputation.js +++ /dev/null @@ -1,36 +0,0 @@ -export const getReputation = (reputation) => { - if (reputation === null) { - return reputation; - } - - if (isFloat(reputation)) { - return Math.floor(reputation); - } - - let _reputation = String(parseInt(reputation, 10)); - - const neg = _reputation.charAt(0) === '-'; - _reputation = neg ? _reputation.substring(1) : _reputation; - - const str = _reputation; - const leadingDigits = parseInt(str.substring(0, 4), 10); - const log = Math.log(leadingDigits) / Math.log(10); - const n = str.length - 1; - let out = n + (log - parseInt(log, 10)); - - // eslint-disable-next-line no-restricted-globals - if (isNaN(out)) { - out = 0; - } - - out = Math.max(out - 9, 0); - out *= neg ? -1 : 1; - out = out * 9 + 25; - out = parseInt(out, 10); - - return out; -}; - -function isFloat(n) { - return Number(n) === n && n % 1 !== 0; -}