refactor: improve readability using filter
This commit is contained in:
parent
80cbebecc4
commit
4490ca3873
1 changed files with 4 additions and 2 deletions
|
|
@ -73,9 +73,11 @@ const Services = () => {
|
||||||
|
|
||||||
const getAccounts = ({ elements, code }) => {
|
const getAccounts = ({ elements, code }) => {
|
||||||
const account = accounts[code]
|
const account = accounts[code]
|
||||||
|
const filterBySecretComponent = R.filter(R.propEq('component', SecretInput))
|
||||||
|
const mapToCode = R.map(R.prop(['code']))
|
||||||
const passwordFields = R.compose(
|
const passwordFields = R.compose(
|
||||||
R.reject(R.isNil),
|
mapToCode,
|
||||||
R.map(({ component, code }) => (component === SecretInput ? code : null))
|
filterBySecretComponent
|
||||||
)(elements)
|
)(elements)
|
||||||
return R.mapObjIndexed(
|
return R.mapObjIndexed(
|
||||||
(value, key) => (R.includes(key, passwordFields) ? '' : value),
|
(value, key) => (R.includes(key, passwordFields) ? '' : value),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue