Skip to main content

List Includes

Uncontrolled node

Overview

The List Includes node checks whether a specific value exists within a list. It performs a strict equality check using JavaScript's Array.includes() method, returning true if the pattern is found in the list, or false if it is not found or if the list is empty.

This node is useful for conditional logic, filtering workflows, or validating that certain values exist in datasets before proceeding with downstream operations.

Strict Equality

The node uses strict equality (===) for comparisons. This means that 1 (number) and "1" (string) are considered different values. Ensure your pattern matches the data type of the items in your list.

Inputs

InputTypeDescriptionDefault
ListDataThe list (array) to search within.-
PatternDataThe value to search for within the list.-

Outputs

OutputTypeDescription
IncludesBooleanReturns true if the pattern exists in the list, false otherwise.

Runtime Behavior and Defaults

  • Empty Lists: If the input list is empty or not a valid array, the node outputs false.
  • Data Types: The comparison uses strict equality. Ensure the pattern matches the type of items in the list (e.g., strings vs numbers).
  • No Events: As an uncontrolled node, this node runs automatically when its inputs change and does not emit or respond to events.

Example Usage

Basic Membership Check

Connect a List node (or any node outputting an array) to the List input, and provide a value to the Pattern input:

List Input: ["apple", "banana", "cherry"]
Pattern Input: "banana"
Output: true
List Input: [1, 2, 3, 4, 5]
Pattern Input: 3
Output: true
List Input: [1, 2, 3, 4, 5]
Pattern Input: "3" // Note: string vs number
Output: false

Conditional Workflow

Use the output with an If node to branch your workflow based on whether an item exists:

  1. Connect List Includes output to the Test input of an If node
  2. If the item exists (true), the workflow proceeds down the "True" branch
  3. If not found (false), it proceeds down the "False" branch

This is commonly used to check if a user ID exists in an allowed list, or if a specific tag is present in a metadata array before processing.