Lodash Function

Execute a Lodash function

Overview

This node executes a selected Lodash function on input data. It supports various Lodash categories such as array, collection, object, string, number, math, and util. Users can specify the input source as the full item, a specific field, or a custom expression, and provide additional arguments in JSON format. The node applies the chosen Lodash function to the input and outputs the result, optionally keeping the original input data. This is useful for data transformation, manipulation, and analysis within workflows, such as filtering arrays, formatting strings, or performing mathematical operations.

Use Case Examples

  1. Filtering an array field in input data using Lodash's 'filter' function.
  2. Transforming a string field to uppercase using Lodash's 'toUpper' function.
  3. Calculating the sum of numbers in an array using Lodash's 'sum' function.

Properties

Name Meaning
Category The Lodash category to select the function from, e.g., array, collection, object, string, number, math, util.
Function The specific Lodash function to execute, loaded dynamically based on the selected category.
Input Source Specifies the source of input data for the Lodash function: full item JSON, a specific field, or a custom expression.
Field Name The name of the field to use as input when 'Specific Field' is selected.
Custom Expression The expression to evaluate for input when 'Custom Expression' is selected.
Additional Arguments (JSON) Additional arguments to pass to the Lodash function, provided as a JSON string.
Output Field The field name where the Lodash function result will be stored in the output JSON.
Keep Input Data Whether to keep the original input data in the output along with the Lodash function result.

Output

JSON

  • result - The result of the executed Lodash function stored in the specified output field.

Dependencies

  • Lodash library

Troubleshooting

  • Error if the specified field is not found in the input item when 'Specific Field' input source is selected. Ensure the field name is correct.
  • Error if the input type does not match the expected type for the selected Lodash function, e.g., a string function but input is not a string.
  • Ensure additional arguments are valid JSON; otherwise, parsing errors may occur.
  • If using custom expressions, ensure the expression syntax is correct and evaluates properly.

Links

Discussion