Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created February 1, 2021 12:27
Show Gist options
  • Save percybolmer/111d983d049cdcfc9eaaff4d9a6f6b52 to your computer and use it in GitHub Desktop.
Save percybolmer/111d983d049cdcfc9eaaff4d9a6f6b52 to your computer and use it in GitHub Desktop.
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.main.HardwareStats} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.main.HardwareStats.toObject = function(includeInstance, msg) {
var f, obj = {
cpu: jspb.Message.getFieldWithDefault(msg, 1, 0),
memoryFree: jspb.Message.getFieldWithDefault(msg, 2, 0),
memoryUsed: jspb.Message.getFieldWithDefault(msg, 3, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment