Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "merge-apply"

Index

Functions

Const mergeApplyMap

  • mergeApplyMap<K, V>(src: Map<K, V>, xs: Map<K, V | Fn<V, V>>): Map<K, V>
  • Similar to mergeApplyObj(), but for ES6 Maps instead of plain objects.

    Type parameters

    • K

    • V

    Parameters

    • src: Map<K, V>
    • xs: Map<K, V | Fn<V, V>>

    Returns Map<K, V>

Const mergeApplyObj

  • mergeApplyObj<V>(src: IObjectOf<V>, xs: IObjectOf<V | Fn<V, V>>): IObjectOf<V>
  • Similar to mergeObjWith(), but only supports 2 args and any function values in xs will be called with respective value in src to produce a new / derived value for that key, i.e.

    dest[k] = xs[k](src[k])

    Returns new merged object and does not modify any of the inputs.

    mergeApplyObj(
      {a: "hello", b: 23, c: 12},
      {a: (x) => x + " world", b: 42}
    );
    // { a: 'hello world', b: 42, c: 12 }

    Type parameters

    • V

    Parameters

    • src: IObjectOf<V>
    • xs: IObjectOf<V | Fn<V, V>>

    Returns IObjectOf<V>

Generated using TypeDoc