# Module: flip
Returns a new object identical to the source
object, but with the key and the value swapped on each of its own enumerable properties.
import { flip } from 'utilist';
flip({ key: 'value', left: 'right' }); // returns { value: 'key', right: 'left' }
remark
Does not mutate the original object.
# Functions
# flip
▸ flip‹T›(source
: T): object
Defined in src/flip.ts:20
Type parameters:
▪ T: object
Parameters:
Name | Type | Description |
---|---|---|
source | T | The object of which the keys and the values should be swapped. |
Returns: object
- [ key: string]: string