Created
December 19, 2020 20:54
-
-
Save fauxsaurus/1d071af186044aa001ee4c844b885cbe to your computer and use it in GitHub Desktop.
Object Utils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const renameObjKey = <T extends Record<string, any>>( | |
oldKey: string, | |
newKey: string, | |
{[oldKey]: value, ...obj}: T, | |
) => Object.assign({[newKey]: value}, obj); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment