• Transforms an object or array into an array of objects with a 'name' property.

    Type Parameters

    • T extends unknown[] | InputObject

      The input type, which can be an object or an array

    Parameters

    • input: T

      The input to be transformed

    Returns T extends unknown[] ? T : ResultItem<T[keyof T]>[]

    • If input is an array, returns the original array
    • If input is an object, returns an array of objects with 'name' property

    If any value in the input object is not an object

    It's mostly used in context like turning networks or volumes in array as in docker compose theses can be represented as :

    networks:
    - network1
    - netowrk2

    or

    networks:
    network1:
    netowrk2:

    This function serves two primary purposes:

    1. Passes through arrays unchanged
    2. Converts objects into an array of objects where:
      • Each array item includes the original key as a 'name' property
      • The original object's properties are spread into the new object