Tweakr
    Preparing search index...

    Function flattenDepth

    • Flattens an array up to the specified depth.

      Parameters

      • array: any[]

        Input array

      • depth: number = 1

        Depth to flatten

      Returns any[]

      Flattened array

      flattenDepth([1,[2,[3]]], 1); // [1,2,[3]]
      

      1.2.0