mirror of
https://github.com/zoriya/flood.git
synced 2026-06-05 03:39:24 +00:00
Adhere to all-caps constants and remove constants which get mutated
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user