Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/invert-kv
Invert the key/value of an object. Example: {foo: 'bar'} → {bar: 'foo'}
https://github.com/sindresorhus/invert-kv
Last synced: about 1 month ago
JSON representation
Invert the key/value of an object. Example: {foo: 'bar'} → {bar: 'foo'}
- Host: GitHub
- URL: https://github.com/sindresorhus/invert-kv
- Owner: sindresorhus
- License: mit
- Created: 2014-06-26T20:07:44.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2022-02-26T06:59:54.000Z (over 2 years ago)
- Last Synced: 2024-04-14T04:19:41.817Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 37
- Watchers: 6
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
- Security: .github/security.md
Awesome Lists containing this project
README
# invert-kv
> Invert the key/value of an object. Example: `{foo: 'bar'}` → `{bar: 'foo'}`
## Install
```
$ npm install invert-kv
```## Usage
```js
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.