SAP Cloud SDK for JavaScript - v4.1.1
    Preparing search index...

    Function transformVariadicArgumentToArray

    • We want to provide methods which accept a variable single number of elements and arrays. The overloaded signature to achieve this is:

      function doSomething(array: T[])
      function doSomething(...varArgs: T[])
      function doSomething(first: undefined | T | T[], ...rest: T[]) {
      //implementation
      }

      This wrapper methods makes it easy build an array from the input.

      Type Parameters

      • T

      Parameters

      • firstOrArray: undefined | T | T[]

        Either an array, the first element of the var args or undefined, if no argument was given.

      • rest: T[]

        Second to last element, if var args were used, empty array, if the first argument is an array.

      Returns T[]

      Array from the input or empty array if no input was given.

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