Last active
December 27, 2022 08:57
-
-
Save ruslanguns/d5a6bd9af6bddb77d6b2f2a2fef82748 to your computer and use it in GitHub Desktop.
enumToString
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
/** | |
* Converts an enum into a String | |
* @param _enum Enum | |
* @returns string type | |
* @gist https://gist.github.com/ruslanguns/d5a6bd9af6bddb77d6b2f2a2fef82748 | |
*/ | |
export const EnumToString = (_enum: object) => | |
Object.keys(_enum) | |
.map(key => _enum[key]) | |
.filter(value => typeof value === 'string') as string[] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Long ago, I saved this repository with the hope that it would serve me, today is the day