refactor: clean code related with removing the _path suffix
This commit is contained in:
parent
edaedd556b
commit
b96bff158f
1 changed files with 5 additions and 5 deletions
|
|
@ -270,12 +270,12 @@ function updateOverride (fields) {
|
|||
'us_ssn'
|
||||
]
|
||||
|
||||
const removePathSuffix = _.map(_.replace('_path', ''))
|
||||
const getPairs = _.map(f => [`${f}_override`, 'automatic'])
|
||||
|
||||
const updatedFields = _.intersection(updateableFields, _.keys(fields))
|
||||
const overrideFields = _.fromPairs(_.map(f =>
|
||||
_.endsWith('_path', f)
|
||||
? [`${_.replace('_path', '_override', f)}`, 'automatic']
|
||||
: [`${f}_override`, 'automatic']
|
||||
, updatedFields))
|
||||
console.log('updatedFields', updatedFields)
|
||||
const overrideFields = _.compose(_.fromPairs, getPairs, removePathSuffix)(updatedFields)
|
||||
|
||||
return _.merge(fields, overrideFields)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue