1.1.2 • Published 2 years ago

object-swap-typed v1.1.2

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

object-swap-typed

npm GitHub tylim88

🐤 swap object key and value and return accurate type.

🥰 0 dependency.

⛲️ Out of box typescript support.

🦺 Tested.

Notice

project has been move to object-swap-typed

Installation

npm i object-swap-typed

Usage

🎵 Usage

import { objSwap } from 'object-swap-typed'

const swapped = objSwap({ 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

1.1.1

2 years ago

1.1.2

2 years ago

1.1.0

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago