Skip to content

invert

Invert the keys and values of an object

94 bytes

Usage

Given an object returns a new object with the keys and values reversed.

import * as _ from 'radashi'
const powersByGod = {
ra: 'sun',
loki: 'tricks',
zeus: 'lightning',
}
_.invert(powersByGod) // => { sun: ra, tricks: loki, lightning: zeus }