Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @sap/cloud-sdk-util

cloud-sdk-utils

Package that contains general utility functions that we reuse multiple times in the SDK. While primarily designed for internal usage, they might also be benefical for consumers of the SDK.

Index

Functions

errorWithCause

  • errorWithCause(message: string, cause: Error): Error
  • Creates a new error using the provided message and appends the causes stacktrace to the new error's stacktrace.

    Parameters

    • message: string

      The message of the new error.

    • cause: Error

      The original error.

    Returns Error

    A new error instance.

flat

  • flat(arr: any[][]): any[]
  • Flatten a multidimensional array

    Parameters

    • arr: any[][]

      Multidimensional array to be flattened

    Returns any[]

    Flattened array

Const pipe

  • pipe(...fns: any[]): (Anonymous function)
  • Parameters

    • Rest ...fns: any[]

    Returns (Anonymous function)

propertyExists

  • propertyExists(obj: object, ...properties: string[]): boolean
  • Parameters

    • obj: object
    • Rest ...properties: string[]

    Returns boolean

unique

  • unique(words: string[]): string[]
  • Remove all duplicates from array

    Parameters

    • words: string[]

      Array of strings that might contain duplicates

    Returns string[]

    Array of unique strings