Changes icon

Changes

Detect differences between two inputs

Changes

AI-generated

Overview

This node detects differences between two sets of input data. It compares each item from the first input with the corresponding item from the second input and categorizes the differences into four types: ADDED, REMOVED, UPDATED, and UNCHANGED. This node is useful for scenarios where you need to track changes between two versions of data, such as comparing records, configurations, or datasets to identify what has been added, removed, updated, or remains unchanged.

Use Case Examples

  1. Comparing two lists of user records to find new, deleted, or modified users.
  2. Detecting changes between two versions of a configuration file.
  3. Tracking updates in inventory data between two time points.

Output

JSON

  • ADDED - Items that are present in the second input but not in the first input.
  • REMOVED - Items that are present in the first input but not in the second input.
  • UPDATED - Items that exist in both inputs but have differences in their content.
  • UNCHANGED - Items that are identical in both inputs.

Dependencies

  • deep-diff-pizza (for computing differences)
  • lodash.set (for setting nested object values)

Troubleshooting

  • Ensure both inputs have the same length or be aware that items without a counterpart in the other input will be treated accordingly (e.g., missing items in the second input are considered REMOVED).
  • If the inputs are not objects or arrays, the diff computation may not work as expected.
  • Large or deeply nested inputs may impact performance due to the deep comparison process.

Discussion