2
0
mirror of https://github.com/Ride-The-Lightning/RTL synced 2024-11-15 18:13:00 +00:00
RTL/common.js

50 lines
1.2 KiB
JavaScript
Raw Normal View History

var common = {};
2019-02-12 13:36:04 +00:00
common.port = 3000;
2019-02-09 20:37:36 +00:00
common.rtl_conf_file_path = '';
2019-01-01 16:26:51 +00:00
common.lnd_server_url = '';
common.lnd_config_path = '';
2019-02-12 13:36:04 +00:00
common.node_auth_type = 'DEFAULT';
2019-02-09 20:37:36 +00:00
common.macaroon_path = '';
common.bitcoind_config_path = '';
2019-02-16 22:43:12 +00:00
common.rtl_pass = '';
2019-01-13 22:55:25 +00:00
common.enable_logging = false;
2019-02-12 13:36:04 +00:00
common.log_file = '';
common.rtl_sso = 0;
2019-02-12 23:13:09 +00:00
common.rtl_cookie_path = '';
2019-02-12 13:36:04 +00:00
common.logout_redirect_link = '/login';
common.cookie = '';
common.convertToBTC = (num) => {
return (num / 100000000).toFixed(6);
};
common.convertTimestampToDate = (num) => {
2018-11-24 20:11:23 +00:00
return new Date(+num*1000).toUTCString();
};
common.sortAscByKey = (array, key) => {
return array.sort(function(a, b) {
var x = a[key]; var y = b[key];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
});
}
common.sortDescByKey = (array, key) => {
return array.sort(function(a, b) {
var x = a[key]; var y = b[key];
return ((x > y) ? -1 : ((x < y) ? 1 : 0));
});
}
common.newestOnTop = (array, key, value) => {
var index = array.findIndex(function(item){
return item[key] === value
});
var newlyAddedRecord = array.splice(index, 1);
array.unshift(newlyAddedRecord[0]);
return array;
}
module.exports = common;