1.0.0 • Published 2 years ago

swob v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

swob

npm GitHub tylim88

🐤 swap object key and value and return accurate type.

🥰 0 dependency.

⛲️ Out of box typescript support.

🦺 Tested.

Installation

npm i swob

Usage

🎵 Usage

import swob from 'swob'

const swapped = swob({ a: '1' as const, b: '2' as const, c: '3' as const })

console.log(swapped) // {'1': 'a','2': 'b','3': 'c'}

type swapped = typeof swapped // {'1': 'a','2': 'b','3': 'c'}

Important, you must use const assertion as shown in above example!

return new object, does not modify original object