chore: use monorepo organization
This commit is contained in:
parent
deaf7d6ecc
commit
a687827f7e
1099 changed files with 8184 additions and 11535 deletions
|
|
@ -0,0 +1,23 @@
|
|||
import * as R from 'ramda'
|
||||
|
||||
import _schema from 'src/pages/Services/schemas'
|
||||
|
||||
const contains = crypto => R.compose(R.contains(crypto), R.prop('cryptos'))
|
||||
const sameClass = type => R.propEq('class', type)
|
||||
const filterConfig = (crypto, type) =>
|
||||
R.filter(it => sameClass(type)(it) && contains(crypto)(it))
|
||||
export const getItems = (accountsConfig, accounts, type, crypto) => {
|
||||
const schema = _schema()
|
||||
const fConfig = filterConfig(crypto, type)(accountsConfig)
|
||||
const find = code => accounts && accounts[code]
|
||||
|
||||
const [filled, unfilled] = R.partition(({ code }) => {
|
||||
const account = find(code)
|
||||
if (!schema[code]) return true
|
||||
|
||||
const { getValidationSchema } = schema[code]
|
||||
return getValidationSchema(account).isValidSync(account)
|
||||
})(fConfig)
|
||||
|
||||
return { filled, unfilled }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue