1. Partial Flattening for Data Inspection
Background
A developer has a nested array from a configuration object.
Problem
Need to flatten only the first level to examine immediate sub-arrays without altering deeper nesting.
How to use
Input the array [1, [2, [3, [4]]], 5] and set depth to 1.
Outcome
The array is flattened to [1, 2, [3, [4]], 5], preserving the innermost structure.