Ride-The-Lightning-RTL/common.js

31 lines
694 B
JavaScript
Raw Normal View History

var common = {};
2019-01-01 17:26:51 +01:00
common.lnd_server_url = '';
common.lnd_config_path = '';
common.bitcoind_config_path = '';
2019-01-13 23:55:25 +01:00
common.enable_logging = false;
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();
};
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));
});
}
module.exports = common;