Function objDefineLazyProperty

  • Defines a lazy property on an object. The property will be lazily evaluated on the first access and then cached for subsequent accesses. The property is both enumerable and configurable.

    Type Parameters

    • T extends Record<string, unknown>

      The type of the object on which the property will be defined. Must be a record with string keys.

    Parameters

    • object: T

      The object on which to define the property.

    • key: string

      The key of the property to define.

    • getValue: ((...args) => unknown)

      A function that returns the value of the property. This function will be called the first time the property is accessed.

        • (...args): unknown
        • Parameters

          • Rest ...args: unknown[]

          Returns unknown

    Returns T

    The original object with the newly defined property.

Generated using TypeDoc