Flatten a list of lists
FreeLogic@rabbinatix/flatten-a-list-of-lists by Rabbinatixupdated Oct 4, 2026
Joins lists into one, and says how many items and distinct items it has.
Each order has a list of products: flatten them to see everything bought. Flatten goes one level deep.
Shows: Flatten, Unique, Length.
How to use it
Add it to your logic, then add a Call Function step in any logic and pick Flatten. It belongs to no system, so every system can use it. Or download the TypeScript and call it from your own code.
Inputs
lists: List of lists
Outputs
items: List
count: Whole number
distinct: Whole number
Previewdrag the steps around; scroll to zoom
Function Entry, Input / output. 0 inputs, 2 outputs. step 1 of 6
Flatten
lists
Flatten, Collection. 1 input, 1 output. step 2 of 6
Flatten
array
result
Length, Collection. 1 input, 1 output. step 3 of 6
Length
array
length
Unique, Collection. 1 input, 1 output. step 4 of 6
Unique
array
result
Length, Collection. 1 input, 1 output. step 5 of 6
Length
array
length
Return, Input / output. 4 inputs, 0 outputs. step 6 of 6
Return
items
count
distinct
Arrow keys: next or previous step in flow order. Alt with arrows: nearest step in that direction. Enter: open. Shift F10: more actions.
Examplesrun live against the logic · 2/2 pass
| Passed | Example | Input | Output |
|---|---|---|---|
| Orders | {"lists":[["tea","cake"],["tea"],[]]} | {"items":["tea","cake","tea"],"count":3,"distinct":2} | |
| Nested deeper | {"lists":[[1,[2]],[3]]} | {"items":[1,[2],3],"count":3,"distinct":3} |
Try it
Versions
In this package
Flatten (entry)
