Consider we have an object and we want to convert all the keys to upper case. How would we go about doing this?
The toPairs
function is used to create a list of key-value pairs from an object.
Now to convert this back to an object we can use the fromPairs
function. It is used to create an object from a list of key-value pairs. If a key appears in multiple pairs, then the rightmost pair is included in the object.
We can pass this all to a pipe
function to create a reusable function as shown: