@cto.af/utils - v1.3.6
    Preparing search index...

    Function select

    • Select some properties from an object into multiple other objects. All unselected fields will be contained in a final object for the "leftovers", meaning there will always be at least one element in the result array. If the first selector is a set of defaults, the type from that object will be copied to the first element of the result array and subtracted from the rest of the results.

      Type Parameters

      • T extends object

        Composed options object.

      • U extends Selector<T>

        May be a Required<Partial> type.

      Parameters

      • obj: T

        The source object.

      • defaultsU: U

        Defaults object or field names.

      Returns [
          Selected<T, U>,
          { [K in string | number | symbol]: Omit<T, SelectedKeys<T, U>>[K] },
      ]

      One object for each of args, plus an extra one for everything that was left over.

    • Select some properties from an object into multiple other objects. All unselected fields will be contained in a final object for the "leftovers", meaning there will always be at least one element in the result array. If the first selector is a set of defaults, the type from that object will be copied to the first element of the result array and subtracted from the rest of the results.

      Type Parameters

      • T extends object

        Composed options object.

      • U extends Selector<T>

        May be a Required<Partial> type.

      • V extends Selector<T>

      Parameters

      • obj: T

        The source object.

      • defaultsU: U

        Defaults object or field names.

      • defaultsV: V

      Returns [
          Selected<T, U>,
          Selected<T, V>,
          {
              [K in string | number | symbol]: Omit<
                  T,
                  SelectedKeys<T, U>
                  | SelectedKeys<T, V>,
              >[K]
          },
      ]

      One object for each of args, plus an extra one for everything that was left over.

    • Select some properties from an object into multiple other objects. All unselected fields will be contained in a final object for the "leftovers", meaning there will always be at least one element in the result array. If the first selector is a set of defaults, the type from that object will be copied to the first element of the result array and subtracted from the rest of the results.

      Type Parameters

      • T extends object

        Composed options object.

      • U extends Selector<T>

        May be a Required<Partial> type.

      • V extends Selector<T>
      • W extends Selector<T>

      Parameters

      • obj: T

        The source object.

      • defaultsU: U

        Defaults object or field names.

      • defaultsV: V
      • defaultsW: W

      Returns [
          Selected<T, U>,
          Selected<T, V>,
          Selected<T, W>,
          {
              [K in string | number | symbol]: Omit<
                  T,
                  SelectedKeys<T, U>
                  | SelectedKeys<T, V>
                  | SelectedKeys<T, W>,
              >[K]
          },
      ]

      One object for each of args, plus an extra one for everything that was left over.