Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "rename-keys"

Index

Functions

Const renameKeysMap

  • renameKeysMap<K, V>(src: Map<K, V>, km: Map<K, K>, out?: Map<K, V>): undefined | Map<K, V>
  • Renames keys in src using mapping provided by key map km. Does support key swapping / swizzling. Does not modify original.

    Type parameters

    • K

    • V

    Parameters

    • src: Map<K, V>
    • km: Map<K, K>
    • Optional out: Map<K, V>

    Returns undefined | Map<K, V>

Const renameKeysObj

  • renameKeysObj<T>(src: T, km: object, out?: any): any
  • Renames keys in src using mapping provided by key map km. Does support key swapping / swizzling. Does not modify original.

    // swap a & b, rename c
    renameKeysObj({a: 1, b: 2, c: 3}, {a: "b", b: "a", c: "cc"})
    // {b: 1, a: 2, cc: 3}

    Type parameters

    • T

    Parameters

    • src: T
    • km: object
    • Default value out: any = {}

    Returns any

Generated using TypeDoc