GitShow/sindresorhus/invert-kv
sindresorhus

invert-kv

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

by sindresorhus
Star on GitHubForknpm

JavaScript

37 stars6 forks5 contributorsQuiet · 4y agoSince 2014v4.2.0MIT

Meet the team

See all 5 on GitHub →
sindresorhus
sindresorhus17 contributions
artginzburg
artginzburg1 contribution
BendingBender
BendingBender1 contribution
filipemerker
filipemerker1 contribution
Richienb
Richienb1 contribution

Languages

View on GitHub →
JavaScript74.6%
TypeScript25.4%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
artginzburg
Implement stronger mapped TypeScript typeMergedPR

Making use of 'keyof' and 'as' keywords, it's possible to make typization much stronger, even allowing to invert the object again and again without losing any types. Before: Calling non-existent keys should have failed, but works ok due to the lack of typization. After: Wow, how is that possible. The type checking has... unfolded in all its power. The solution is based on this StackOverflow thread: https://stackoverflow.com/a/56416192/11474669

artginzburg · 4y ago
Richienb
Move to GitHub ActionsMergedPR
Richienb · 5y ago
filipemerker
Fix the input type checkMergedPR

At the moment, if this function receives as a parameter, it will fail to throw the appropriate error. This PR adds a check for as a possible and improves testing, taking this into account.

filipemerker · 6y ago
Structured data for AI agents

Repository: sindresorhus/invert-kv. Description: Invert the key/value of an object. Example: {foo: 'bar'} → {bar: 'foo'} Stars: 37, Forks: 6. Primary language: JavaScript. Languages: JavaScript (74.6%), TypeScript (25.4%). License: MIT. Latest release: v4.2.0 (4y ago). Open PRs: 0, open issues: 0. Last activity: 4y ago. Community health: 85%. Top contributors: sindresorhus, artginzburg, BendingBender, filipemerker, Richienb.

·@ofershap

Replace github.com with gitshow.dev