Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "invert"

Index

Functions

Functions

Const invertMap

  • invertMap<K, V>(src: Map<K, V>): Map<V, K>
  • Returns a new map in which the original values are used as keys and original keys as values.

    invertMap(new Map([["a", 1], ["b", 2]]));
    // Map { 1 => 'a', 2 => 'b' }

    Type parameters

    • K

    • V

    Parameters

    • src: Map<K, V>

    Returns Map<V, K>

Const invertObj

  • invertObj(src: IObjectOf<PropertyKey>): IObjectOf<string | number | symbol>
  • Returns a new object in which the original values are used as keys and original keys as values.

    invertObj({a: 1, b: 2})
    // { '1': 'a', '2': 'b' }

    Parameters

    • src: IObjectOf<PropertyKey>

    Returns IObjectOf<string | number | symbol>

Generated using TypeDoc