Creates a new object with keys and values swapped.
The type of the source object.
The object to invert.
A new object with keys and values swapped.
// ES Moduleimport { invert } from '@bnidev/js-utils'// CommonJSconst { invert } = require('@bnidev/js-utils') Copy
// ES Moduleimport { invert } from '@bnidev/js-utils'// CommonJSconst { invert } = require('@bnidev/js-utils')
const obj = { a: '1', b: '2', c: '3' }const result = invert(obj)// result: { '1': 'a', '2': 'b', '3': 'c' } Copy
const obj = { a: '1', b: '2', c: '3' }const result = invert(obj)// result: { '1': 'a', '2': 'b', '3': 'c' }
Creates a new object with keys and values swapped.