Skip to content

Instantly share code, notes, and snippets.

View DDzia's full-sized avatar
:octocat:

Dziarkach Dzianis DDzia

:octocat:
  • Social Discovery Ventures
  • Belarus, Minsk
View GitHub Profile
enum Names {
Alex = 0,
Denis = -1
}
/**
* 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]);
}
var isValueProperty = !Number.isNaN(parseInt(enumMember, 10));
enum Names {
Alex = "a",
Denis = "d"
}
var Names;
(function (Names) {
Names["Alex"] = "a";
Names["Denis"] = "d";
})(Names || (Names = {}));
/**
* 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;
enum Size {
One = 1,
All = "all"
}
var Size;
(function (Size) {
Size[Size["One"] = 1] = "One";
Size["All"] = "all";
})(Size || (Size = {}));
/**
* 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 => {
#include <iostream>
#include "global.h"
DLLEXPORT void PrintToDo()
{
std::cout << "TODO!" << std::endl;
}