Skip to content

Instantly share code, notes, and snippets.

@othree
Created July 22, 2015 10:46
Show Gist options
  • Save othree/dc254e34056f86fa069e to your computer and use it in GitHub Desktop.
Save othree/dc254e34056f86fa069e to your computer and use it in GitHub Desktop.
(function () {
var decode = ProtoBuf.Reflect.Message.Field.prototype.decode;
ProtoBuf.Reflect.Message.Field.prototype.decode = function () {
var value = decode.apply(this, arguments);
if (ProtoBuf.TYPES["enum"] === this.type) {
var values = this.resolvedType.children;
for (var i=0; i<values.length; i++){
if (values[i].id == value){
return values[i].name;
}
}
}
return value;
}
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment