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.
the object to invert
a new object with the keys and values inverted
import { invertObject } from "@trashpanda001/helpers/object"invertObject({ a: "alpha", b: "beta" })// { alpha: "a", beta: "b" } Copy
import { invertObject } from "@trashpanda001/helpers/object"invertObject({ a: "alpha", b: "beta" })// { alpha: "a", beta: "b" }
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.