MCPcopy
hub / github.com/open-telemetry/opentelemetry-demo / toJSON

Function toJSON

src/frontend/protos/demo.ts:342–351  ·  view source on GitHub ↗
(message: CartItem)

Source from the content-addressed store, hash-verified

340 },
341
342 toJSON(message: CartItem): unknown {
343 const obj: any = {};
344 if (message.productId !== "") {
345 obj.productId = message.productId;
346 }
347 if (message.quantity !== 0) {
348 obj.quantity = Math.round(message.quantity);
349 }
350 return obj;
351 },
352
353 create<I extends Exact<DeepPartial<CartItem>, I>>(base?: I): CartItem {
354 return CartItem.fromPartial(base ?? ({} as any));

Callers

nothing calls this directly

Calls 1

toJSONMethod · 0.80

Tested by

no test coverage detected