This file contains hidden or 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
enum Names { | |
Alex = 0, | |
Denis = -1 | |
} |
This file contains hidden or 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
/** | |
* 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]); | |
} |
This file contains hidden or 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
var isValueProperty = !Number.isNaN(parseInt(enumMember, 10)); |
This file contains hidden or 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
enum Names { | |
Alex = "a", | |
Denis = "d" | |
} |
This file contains hidden or 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
var Names; | |
(function (Names) { | |
Names["Alex"] = "a"; | |
Names["Denis"] = "d"; | |
})(Names || (Names = {})); |
This file contains hidden or 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
/** | |
* Check to numeral enumeration. | |
*/ | |
private static isNumeral(enumType: object) { | |
const members = Object.keys(enumType); | |
if (!members.some((x) => true)) { | |
throw new TypeError("Invalid enumeration type."); | |
} | |
let parsedCount = 0; |
This file contains hidden or 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
enum Size { | |
One = 1, | |
All = "all" | |
} |
This file contains hidden or 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
var Size; | |
(function (Size) { | |
Size[Size["One"] = 1] = "One"; | |
Size["All"] = "all"; | |
})(Size || (Size = {})); |
This file contains hidden or 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
/** | |
* Get all keys from enumeration. | |
*/ | |
public static keys(enumType: object) { | |
const members = Object.keys(enumType);<br /> let keys: string[]; | |
if (!EnumHelpers.isNumeral(enumType)) { | |
keys = members; | |
} else { | |
keys = []; | |
members.forEach(x => { |
This file contains hidden or 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
#include <iostream> | |
#include "global.h" | |
DLLEXPORT void PrintToDo() | |
{ | |
std::cout << "TODO!" << std::endl; | |
} |