@cto.af/utils - v1.3.2
    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.

      Type Parameters

      • T extends object

        Composed options object.

      • U extends Selector<T>

        May be a Required<Partial> type.

      Parameters

      • obj: T

        The source object.

      • Optionaldefaults: U

        Defaults object or field names.

      • ...args: Selector<T>[]

        Arrays of strings to select into the result objects.

      Returns [U extends Partial<T> ? U<U> : Partial<T>, ...Partial<T>[]]

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