UNPKG

@mic-rexjs/usecases-react

Version:

React-based solution for use usecases of Clean Architecture

15 lines (14 loc) 472 B
import { compareProperty } from '../compareProperty'; export const triggerWatchers = (watch, newEntity, oldEntity) => { for (const [fieldPath, watcher] of Object.entries(watch)) { compareProperty(oldEntity, newEntity, fieldPath, (oldValue, newValue, fieldPaths) => { watcher({ fieldPaths, newEntity, oldEntity, newValue, oldValue, }); }); } };