Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript enum to array

// Helper
const StringIsNumber = value => isNaN(Number(value)) === false;

// Turn enum into array
function ToArray(enumme) {
    return Object.keys(enumme)
        .filter(StringIsNumber)
        .map(key => enumme[key]);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #typescript #enum #array
ADD COMMENT
Topic
Name
7+8 =