Skip to content

Instantly share code, notes, and snippets.

@DDzia
Created April 19, 2019 19:17
Show Gist options
  • Save DDzia/eaa2dc5bf712fd2c3c5caa632a504d4a to your computer and use it in GitHub Desktop.
Save DDzia/eaa2dc5bf712fd2c3c5caa632a504d4a to your computer and use it in GitHub Desktop.
/**
* Sample from stack overflow.
* @see https://stackoverflow.com/a/18112157
*/
function getValues(enumType: object) {
for (var enumMember in enumType) {
var isValueProperty = parseInt(enumMember, 10) >= 0
if (isValueProperty) {
console.log("enum member: ", enumType[enumMember]);
}
}
}
// run to check
getValues(Names);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment