swob
Installation
npm i swob
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