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 _ = require('lodash/fp')
const R = require('ramda')
const db = require('./db') const db = require('./db')
const dbm = require('./postgresql_interface') const dbm = require('./postgresql_interface')
@ -57,11 +56,13 @@ function fetchPhoneTx (phone) {
return db.any(sql, values) return db.any(sql, values)
.then(_.map(toCashOutTx)) .then(_.map(toCashOutTx))
.then(txs => { .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) { if (confirmedTxs.length > 0) {
const maxTx = R.reduce((acc, val) => { const reducer = (acc, val) => {
return !acc || val.cryptoAtoms.gt(acc.cryptoAtoms) ? val : acc return !acc || val.cryptoAtoms.gt(acc.cryptoAtoms) ? val : acc
}, null, confirmedTxs) }
const maxTx = _.reduce(reducer, null, confirmedTxs)
return maxTx return maxTx
} }

View file

@ -47,7 +47,6 @@
"pify": "^3.0.0", "pify": "^3.0.0",
"pretty-ms": "^2.1.0", "pretty-ms": "^2.1.0",
"promise-sequential": "^1.1.1", "promise-sequential": "^1.1.1",
"ramda": "^0.22.1",
"serve-static": "^1.12.4", "serve-static": "^1.12.4",
"socket.io": "^2.0.3", "socket.io": "^2.0.3",
"socket.io-client": "^2.0.3", "socket.io-client": "^2.0.3",

View file

@ -1,7 +1,6 @@
// Pull latest from: http://www.currency-iso.org/en/home/tables/table-a1.html // Pull latest from: http://www.currency-iso.org/en/home/tables/table-a1.html
// Convert to JSON at: http://www.csvjson.com/csv2json // Convert to JSON at: http://www.csvjson.com/csv2json
const R = require('ramda')
const currencies = require('../currencies.json') const currencies = require('../currencies.json')
function goodCurrency (currency) { function goodCurrency (currency) {