MCPcopy Create free account
hub / github.com/microsoft/SandDance / diffDataProps

Function diffDataProps

docs/tests/v2/es6/js/sanddance.js:42371–42389  ·  view source on GitHub ↗
(props, oldProps)

Source from the content-addressed store, hash-verified

42369
42370
42371function diffDataProps(props, oldProps) {
42372 if (oldProps === null) {
42373 return 'oldProps is null, initial diff';
42374 } // Support optional app defined comparison of data
42375
42376
42377 var dataComparator = props.dataComparator;
42378
42379 if (dataComparator) {
42380 if (!dataComparator(props.data, oldProps.data)) {
42381 return 'Data comparator detected a change';
42382 } // Otherwise, do a shallow equal on props
42383
42384 } else if (props.data !== oldProps.data) {
42385 return 'A new data container was supplied';
42386 }
42387
42388 return null;
42389} // Checks if any update triggers have changed
42390// also calls callback to invalidate attributes accordingly.
42391
42392

Callers 1

diffPropsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected