Open Cap Table Protocol Canton SDK - v0.2.224
    Preparing search index...

    Function ensureArray

    • Ensure a value is an array, normalizing null/undefined to an empty array.

      This is useful for OCF fields that should be arrays but may come from raw data where they are null or undefined. The SDK normalizes these to empty arrays to satisfy DAML contract requirements.

      Type Parameters

      • T

      Parameters

      • value: T[] | null | undefined

        The value to normalize (may be undefined, null, or an array)

      Returns T[]

      The array value, or an empty array if the input was null/undefined

        ensureArray([1, 2, 3]); // Returns [1, 2, 3]
      ensureArray(null); // Returns []
      ensureArray(undefined); // Returns []