Skip to content

Instantly share code, notes, and snippets.

@ruslanguns
Last active December 27, 2022 08:57
Show Gist options
  • Save ruslanguns/d5a6bd9af6bddb77d6b2f2a2fef82748 to your computer and use it in GitHub Desktop.
Save ruslanguns/d5a6bd9af6bddb77d6b2f2a2fef82748 to your computer and use it in GitHub Desktop.
enumToString
/**
* 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[]
@Ciber-daniel
Copy link

Long ago, I saved this repository with the hope that it would serve me, today is the day

@ruslanguns
Copy link
Author

@Ciber-daniel I am glad it helped

@duranduranduran
Copy link

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment