Options
All
  • Public
  • Public/Protected
  • All
Menu

Module invert

Index

References

Functions Object

References

Renames and re-exports __type

Object Functions

  • invert<T>(object: T): any
  • Creates an object composed of the inverted keys and values of object. If object contains duplicate values, subsequent values overwrite property assignments of previous values.

    since

    5.7.0

    example
    const object = { 'a': 1, 'b': 2, 'c': 1 }

    invert(object)
    // => { '1': 'c', '2': 'b' }

    Type parameters

    • T

    Parameters

    • object: T

      The object to invert.

    Returns any

    Returns the new inverted object.