@trashpanda001/helpers
    Preparing search index...

    Function invertObject

    • Invert an object's key/values.

      Values are coerced to strings as an object's key must be a string. Duplicate values are overwritten by the latest value.

      Parameters

      • object: Readonly<Record<string, PropertyKey>>

        the object to invert

      Returns Record<string, string>

      a new object with the keys and values inverted

      import { invertObject } from "@trashpanda001/helpers/object"

      invertObject({ a: "alpha", b: "beta" })
      // { alpha: "a", beta: "b" }