mirror of
https://github.com/Expand-sys/ccashfrontend
synced 2025-12-19 16:12:14 +11:00
12 lines
No EOL
411 B
JavaScript
12 lines
No EOL
411 B
JavaScript
const _ = require('lodash');
|
|
|
|
module.exports = (req, fieldInstances) => {
|
|
fieldInstances.filter(instance => {
|
|
const initialValue = _.get(req[instance.location], instance.path);
|
|
return initialValue !== instance.value;
|
|
}).forEach(instance => {
|
|
instance.path === ''
|
|
? _.set(req, instance.location, instance.value)
|
|
: _.set(req[instance.location], instance.path, instance.value);
|
|
});
|
|
}; |