mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2024-11-19 09:50:36 +01:00
31 lines
694 B
JavaScript
31 lines
694 B
JavaScript
var common = {};
|
|
|
|
common.lnd_server_url = '';
|
|
common.lnd_config_path = '';
|
|
common.bitcoind_config_path = '';
|
|
common.enable_logging = false;
|
|
|
|
common.convertToBTC = (num) => {
|
|
return (num / 100000000).toFixed(6);
|
|
};
|
|
|
|
common.convertTimestampToDate = (num) => {
|
|
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;
|