2018-10-10 02:08:05 +02:00
|
|
|
var common = {};
|
|
|
|
|
2019-02-12 14:36:04 +01:00
|
|
|
common.port = 3000;
|
2019-02-09 21:37:36 +01:00
|
|
|
common.rtl_conf_file_path = '';
|
2019-01-01 17:26:51 +01:00
|
|
|
common.lnd_server_url = '';
|
2019-01-19 04:04:16 +01:00
|
|
|
common.lnd_config_path = '';
|
2019-02-12 14:36:04 +01:00
|
|
|
common.node_auth_type = 'DEFAULT';
|
2019-02-09 21:37:36 +01:00
|
|
|
common.macaroon_path = '';
|
2019-01-19 04:04:16 +01:00
|
|
|
common.bitcoind_config_path = '';
|
2019-01-13 23:55:25 +01:00
|
|
|
common.enable_logging = false;
|
2019-02-12 14:36:04 +01:00
|
|
|
common.log_file = '';
|
|
|
|
common.rtl_sso = 0;
|
|
|
|
common.rtl_cookie_file = '';
|
|
|
|
common.logout_redirect_link = '/login';
|
|
|
|
common.cookie = '';
|
2018-10-10 02:08:05 +02:00
|
|
|
|
|
|
|
common.convertToBTC = (num) => {
|
|
|
|
return (num / 100000000).toFixed(6);
|
|
|
|
};
|
|
|
|
|
|
|
|
common.convertTimestampToDate = (num) => {
|
2018-11-24 21:11:23 +01:00
|
|
|
return new Date(+num*1000).toUTCString();
|
2018-10-10 02:08:05 +02:00
|
|
|
};
|
|
|
|
|
2019-01-20 00:47:56 +01:00
|
|
|
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));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-02-05 00:49:19 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2018-10-10 02:08:05 +02:00
|
|
|
module.exports = common;
|