Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "xform/map-vals"

Index

Functions

Functions

mapVals

  • mapVals<A, B>(fn: Fn<A, B>, copy?: undefined | false | true): Transducer<IObjectOf<A>, IObjectOf<B>>
  • mapVals<A, B>(fn: Fn<A, B>, src: Iterable<IObjectOf<A>>): IterableIterator<IObjectOf<B>>
  • mapVals<A, B>(fn: Fn<A, B>, copy: boolean, src: Iterable<IObjectOf<A>>): IterableIterator<IObjectOf<B>>
  • Transducer. Similar to {@link (map:1)}, but expects object values and the given function fn is applied to each enumerable property value and the results reassigned to their original keys.

    remarks

    By default, a shallow copy of the source object is created. The resulting object is then used as the result of this transducer.

    example
    [...mapVals((x)=> x * 10, [{a: 1, b: 2}, {c: 3, d: 4}])]
    // [ { a: 10, b: 20 }, { c: 30, d: 40 } ]

    Type parameters

    • A

    • B

    Parameters

    • fn: Fn<A, B>

      -

    • Optional copy: undefined | false | true

      if true (default), creates a shallow copy of each incoming value

    Returns Transducer<IObjectOf<A>, IObjectOf<B>>

  • Type parameters

    • A

    • B

    Parameters

    • fn: Fn<A, B>
    • src: Iterable<IObjectOf<A>>

    Returns IterableIterator<IObjectOf<B>>

  • Type parameters

    • A

    • B

    Parameters

    • fn: Fn<A, B>
    • copy: boolean
    • src: Iterable<IObjectOf<A>>

    Returns IterableIterator<IObjectOf<B>>

Generated using TypeDoc