Flattens nested arrays up to the specified depth.
Optional
const nested = [ [1, 2], [3, 4],] as const;const flatOnce = Arr.flat(nested, 1);const flatCurried = Arr.flat()(nested);assert.deepStrictEqual(flatOnce, [1, 2, 3, 4]);assert.deepStrictEqual(flatCurried, [1, 2, 3, 4]); Copy
const nested = [ [1, 2], [3, 4],] as const;const flatOnce = Arr.flat(nested, 1);const flatCurried = Arr.flat()(nested);assert.deepStrictEqual(flatOnce, [1, 2, 3, 4]);assert.deepStrictEqual(flatCurried, [1, 2, 3, 4]);
Flattens nested arrays up to the specified depth.