Function lens

Creates a lens for a specific property.

  • Type Parameters

    • T

      The parent object type.

    • U

      The property type.

    Parameters

    • getter: ((obj: T) => U)

      Function to get the property.

        • (obj): U
        • Parameters

          • obj: T

          Returns U

    • setter: ((value: U, obj: T) => T)

      Function to set the property immutably.

        • (value, obj): T
        • Parameters

          • value: U
          • obj: T

          Returns T

    Returns Lens<T, U>