Function transform

  • An alternative to reduce; this function transforms object to a new accumulator object which is the result of running each of its own enumerable string keyed properties thru iteratee, with each invocation potentially mutating the accumulator object. If accumulator is not provided, a new plain object ({}) will be used. Iteratee functions may exit iteration early by explicitly returning false.

    Differences from lodash:

    • the default accumulator will not have any special prototype, it will simply be {}
    • does not treat sparse arrays as dense

    Contribution to minified bundle size, when it is the only function imported:

    • Lodash: 16,402 bytes
    • Micro-dash: 318 bytes

    Type Parameters

    • E

    • A

    Parameters

    • array: undefined | readonly E[]
    • iteratee: ((accumulator, value, index) => boolean | void)
        • (accumulator, value, index): boolean | void
        • Parameters

          • accumulator: A
          • value: E
          • index: number

          Returns boolean | void

    • Optional accumulator: A

    Returns A

  • Type Parameters

    • E

    • A

    Parameters

    • object: undefined | ObjectWith<E>
    • iteratee: ((accumulator, value, key) => boolean | void)
        • (accumulator, value, key): boolean | void
        • Parameters

          • accumulator: A
          • value: E
          • key: string

          Returns boolean | void

    • Optional accumulator: A

    Returns A

Generated using TypeDoc