code: function toEnumName(value) {
    var result = '';
    var wasLower = false;
    for (var i = 0; i < value.length; i++) {
      var c = value.charAt(i);
      var isLower = /[a-z]/.test(c);
      if (!isLower && wasLower) {
        result += '_';
      }
      result += c.toUpperCase();
      wasLower = isLower;
    }
    if (!isNaN(value[0])) {
      result = '_' + result;
    }
    result = result.replace(/[^\w]/g, '_');
    result = result.replace(/_+/g, '_');
    return result;
  }
docs: Converts a given enum value into the enum name