Function flat

  • Flattens an array. Basically replacing Array.prototype.flat for which Rhino doesn't yet have an implementation

    Type Parameters

    • A extends any[]
    • D extends number = 1

    Parameters

    • arr: A

      Array to flatten

    • depth: number = Infinity

      Number of layers to flatten by; Infinity for a fully flat array

    Returns FlatArray<A, D>[]

    Flattened array

    KoLMafia now supports the flat and flatMap methods