invert-kv

May 3, 2021 ยท View on GitHub

Invert the key/value of an object. Example: {foo: 'bar'} โ†’ {bar: 'foo'}

Install

$ npm install invert-kv

Usage

import invertKeyValue from 'invert-kv';

invertKeyValue({foo: 'bar', '๐Ÿฆ„': '๐ŸŒˆ'});
//=> {bar: 'foo', '๐ŸŒˆ': '๐Ÿฆ„'}

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.