How to use the deep-diff function in deep-diff

To help you get started, we’ve selected a few deep-diff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TinkoffCreditSystems / react-render-logger / src / createLogger.js View on Github external
function logger(nextProps, nextState) {
        if (enabled(groupName) || enabled(traceGroupName)) {
          const
            startTime = now(),
            time = new Date(),
            propsDiff = differ(this.props, nextProps),
            stateDiff = differ(this.state, nextState),
            groupTitle = `${groupName} @${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}`

          logGroup(groupTitle)
          logPropsDiff(propsDiff)
          logStateDiff(stateDiff)

          console.debug(`→ logger took ${(now() - startTime).toFixed(3)}ms on instance ${this._reactInternalInstance._rootNodeID}`) // eslint-disable-line no-underscore-dangle
          console.groupEnd(groupName)
        }
      }
github alleyinteractive / simplechart / app / middleware / actionLogging.js View on Github external
function _getDiff(oldVal, newVal, actionType) {
  const calcDiff = diff(oldVal, newVal);
  if (!calcDiff || !calcDiff.length) {
    return 'No changes';
  }

  return calcDiff.reduce((log, change) => {
    let kind = _getChangeKind(change.kind);
    let location;

    // Special case to skip RECEIVE_CHART_OPTIONS* since it merges in new fields
    if ('D' === change.kind && actions.RECEIVE_CHART_OPTIONS === actionType) {
      return log;
    }

    // If not an array change
    if ('A' !== change.kind) {
      location = change.path.join('.');
github unirakun / k-ramel / packages / k-ramel / misc / test-suite.js View on Github external
    const getDiffPaths = (before, after) => Array.from(new Set(diff(before, after).map(({ path }) => path.join('.'))))
github codylindley / k-ui-react-jquery-wrappers / packages / dropDownList / src / index.js View on Github external
if(this.widgetInstance.setOptions){
			if(nextProps.options){
				this.widgetInstance.setOptions(nextProps.options);
			}
		}

		//try and determine if any of the nextProps have changed, and if so, update the widget
		if(nextProps.methods){
			if(deepDiff(nextProps.methods,this.props.methods)){
				this.callKendoWidgetMethods(nextProps.methods);
			}
		}

		if(nextProps.unbindEvents){
			if(deepDiff(nextProps.unbindEvents,this.props.unbindEvents)){
				this.unbindEventsToKendoWidget(nextProps.unbindEvents);
			}
		}

		if(nextProps.triggerEvents){
			if(deepDiff(nextProps.triggerEvents,this.props.triggerEvents)){
				this.triggerKendoWidgetEvents(nextProps.triggerEvents);
			}
		}
	},
github codylindley / k-ui-react-jquery-wrappers / packages / colorPicker / src / index.js View on Github external
componentWillReceiveProps: function(nextProps){
		//always update the widget with nextProp changes if avaliable
		if(nextProps.events){
			this.bindEventsToKendoWidget(nextProps.events);
		}

		if(this.widgetInstance.setOptions){
			if(nextProps.options){
				this.widgetInstance.setOptions(nextProps.options);
			}
		}

		//try and determine if any of the nextProps have changed, and if so, update the widget
		if(nextProps.methods){
			if(deepDiff(nextProps.methods,this.props.methods)){
				this.callKendoWidgetMethods(nextProps.methods);
			}
		}

		if(nextProps.unbindEvents){
			if(deepDiff(nextProps.unbindEvents,this.props.unbindEvents)){
				this.unbindEventsToKendoWidget(nextProps.unbindEvents);
			}
		}

		if(nextProps.triggerEvents){
			if(deepDiff(nextProps.triggerEvents,this.props.triggerEvents)){
				this.triggerKendoWidgetEvents(nextProps.triggerEvents);
			}
		}
	},
github zzorba / ArkhamCards / components / filter / withFilterFunctions.tsx View on Github external
hasChanges() {
      const {
        defaultFilterState,
        currentFilters,
      } = this.props;
      const differences = (clearTraits && clearTraits.length) ?
        deepDiff(
          pick(currentFilters, clearTraits),
          pick(defaultFilterState, clearTraits)
        ) :
        deepDiff(currentFilters, defaultFilterState);
      return differences && differences.length;
    }
github codylindley / k-ui-react-jquery-wrappers / packages / listView / src / index.js View on Github external
componentWillReceiveProps: function(nextProps){
		//always update the widget with nextProp changes if avaliable
		if(nextProps.events){
			this.bindEventsToKendoWidget(nextProps.events);
		}

		if(this.widgetInstance.setOptions){
			if(nextProps.options){
				this.widgetInstance.setOptions(nextProps.options);
			}
		}

		//try and determine if any of the nextProps have changed, and if so, update the widget
		if(nextProps.methods){
			if(deepDiff(nextProps.methods,this.props.methods)){
				this.callKendoWidgetMethods(nextProps.methods);
			}
		}

		if(nextProps.unbindEvents){
			if(deepDiff(nextProps.unbindEvents,this.props.unbindEvents)){
				this.unbindEventsToKendoWidget(nextProps.unbindEvents);
			}
		}

		if(nextProps.triggerEvents){
			if(deepDiff(nextProps.triggerEvents,this.props.triggerEvents)){
				this.triggerKendoWidgetEvents(nextProps.triggerEvents);
			}
		}
	},
github codylindley / k-ui-react-jquery-wrappers / packages / datePicker / src / index.js View on Github external
//try and determine if any of the nextProps have changed, and if so, update the widget
		if(nextProps.methods){
			if(deepDiff(nextProps.methods,this.props.methods)){
				this.callKendoWidgetMethods(nextProps.methods);
			}
		}

		if(nextProps.unbindEvents){
			if(deepDiff(nextProps.unbindEvents,this.props.unbindEvents)){
				this.unbindEventsToKendoWidget(nextProps.unbindEvents);
			}
		}

		if(nextProps.triggerEvents){
			if(deepDiff(nextProps.triggerEvents,this.props.triggerEvents)){
				this.triggerKendoWidgetEvents(nextProps.triggerEvents);
			}
		}
	},
github codylindley / k-ui-react-jquery-wrappers / packages / spreadsheet / src / index.js View on Github external
//try and determine if any of the nextProps have changed, and if so, update the widget
		if(nextProps.methods){
			if(deepDiff(nextProps.methods,this.props.methods)){
				this.callKendoWidgetMethods(nextProps.methods);
			}
		}

		if(nextProps.unbindEvents){
			if(deepDiff(nextProps.unbindEvents,this.props.unbindEvents)){
				this.unbindEventsToKendoWidget(nextProps.unbindEvents);
			}
		}

		if(nextProps.triggerEvents){
			if(deepDiff(nextProps.triggerEvents,this.props.triggerEvents)){
				this.triggerKendoWidgetEvents(nextProps.triggerEvents);
			}
		}
	},
github kendo-labs / kendo-ui-boilerplates / core-jquery-react-webpack-es6 / src / kendoDropDownList.js View on Github external
componentWillReceiveProps: function(nextProps){
		//always update the widget with nextProp changes if avaliable
		if(nextProps.events){
			this.bindEventsToKendoWidget(nextProps.events);
		}

		if(this.widgetInstance.setOptions){
			if(nextProps.options){
				this.widgetInstance.setOptions(nextProps.options);
			}
		}

		//try and determine if any of the nextProps have changed, and if so, update the widget
		if(nextProps.methods){
			if(deepDiff(nextProps.methods,this.props.methods)){
				this.callKendoWidgetMethods(nextProps.methods);
			}
		}

		if(nextProps.unbindEvents){
			if(deepDiff(nextProps.unbindEvents,this.props.unbindEvents)){
				this.unbindEventsToKendoWidget(nextProps.unbindEvents);
			}
		}

		if(nextProps.triggerEvents){
			if(deepDiff(nextProps.triggerEvents,this.props.triggerEvents)){
				this.triggerKendoWidgetEvents(nextProps.triggerEvents);
			}
		}
  	},

deep-diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.

MIT
Latest version published 6 years ago

Package Health Score

73 / 100
Full package analysis