remove ramda dependency

This commit is contained in:
Josh Harvey 2018-03-11 19:37:27 +00:00
parent 28d84cbbcf
commit 982c60c7f5
3 changed files with 5 additions and 6 deletions

View file

@ -1,5 +1,4 @@
const _ = require('lodash/fp')
const R = require('ramda')
const db = require('./db')
const dbm = require('./postgresql_interface')
@ -57,11 +56,13 @@ function fetchPhoneTx (phone) {
return db.any(sql, values)
.then(_.map(toCashOutTx))
.then(txs => {
const confirmedTxs = txs.filter(tx => R.contains(tx.status, ['instant', 'confirmed']))
const confirmedTxs = txs.filter(tx => _.includes(tx.status, ['instant', 'confirmed']))
if (confirmedTxs.length > 0) {
const maxTx = R.reduce((acc, val) => {
const reducer = (acc, val) => {
return !acc || val.cryptoAtoms.gt(acc.cryptoAtoms) ? val : acc
}, null, confirmedTxs)
}
const maxTx = _.reduce(reducer, null, confirmedTxs)
return maxTx
}