• Split an array into two based on a condition.

    Type Parameters

    • T


    • arr: T[]

      Array to partition.

    • condition: ((item) => boolean)

      Function to determine to where to put each item.

        • (item): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns [T[], T[]]

    A two dimensional array containing two arrays, where the first one includes all items where the given condition was met and the second one includes all items where it was not met.

    Copyright Ⓒ 2024 SAP SE or an SAP affiliate company. All rights reserved.