Adhere to all-caps constants and remove constants which get mutated

This commit is contained in:
John Furrow
2016-08-13 21:06:46 -07:00
parent e9387713fb
commit 2783f26b21
28 changed files with 76 additions and 78 deletions
+4 -4
View File
@@ -1,18 +1,18 @@
'use strict';
let moment = require('moment');
var FormatUtil = {
const FORMAT_UTIL = {
minToHumanReadable: min => {
return moment.duration(min * 60 * 1000).humanize();
},
parsePeers: (string) => {
var markerPosition = string.indexOf('@!@');
let markerPosition = string.indexOf('@!@');
return string.substr(0, markerPosition);
},
status: (isHashChecking, isComplete, isOpen, uploadRate, downloadRate, state, message) => {
var torrentStatus = [];
let torrentStatus = [];
if (isHashChecking === '1') {
torrentStatus.push('ch'); // checking
@@ -44,4 +44,4 @@ var FormatUtil = {
}
}
module.exports = FormatUtil;
module.exports = FORMAT_UTIL;
+2 -2
View File
@@ -1,6 +1,6 @@
'use strict';
let objectUtil = {
const OBJECT_UTIL = {
reflect: (hash) => {
return Object.keys(hash).reduce((memo, key) => {
memo[key] = hash[key];
@@ -10,4 +10,4 @@ let objectUtil = {
}
}
module.exports = objectUtil;
module.exports = OBJECT_UTIL;
+2 -2
View File
@@ -1,8 +1,8 @@
'use strict';
const regEx = {
const REG_EX = {
url: /^(?:https?|ftp):\/\/.{1,}\.{1}.{1,}/,
domainName: /https?:\/\/(?:www\.)?([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,18}\b)*(\/[\/\d\w\.-]*)*(?:[\?])*(.+)*/i
};
module.exports = regEx;
module.exports = REG_EX;
+2 -2
View File
@@ -1,6 +1,6 @@
'use strict';
let stringUtil = {
const STRING_UTIL = {
capitalize: (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
},
@@ -18,4 +18,4 @@ let stringUtil = {
}
}
module.exports = stringUtil;
module.exports = STRING_UTIL;