MCPcopy Create free account
hub / github.com/apache/fory / compatibleArrayPutAccessor

Function compatibleArrayPutAccessor

javascript/packages/core/lib/gen/collection.ts:103–118  ·  view source on GitHub ↗
(
  elementTypeId: number,
  result: string,
  item: string,
  index: string,
)

Source from the content-addressed store, hash-verified

101}
102
103function compatibleArrayPutAccessor(
104 elementTypeId: number,
105 result: string,
106 item: string,
107 index: string,
108): string {
109 switch (elementTypeId) {
110 case TypeId.BOOL:
111 case TypeId.BFLOAT16:
112 return `${result}.setValue(${index}, ${item})`;
113 case TypeId.FLOAT16:
114 return `typeof ${result}.setValue === "function" ? ${result}.setValue(${index}, ${item}) : ${result}[${index}] = ${item}`;
115 default:
116 return `${result}[${index}] = ${item}`;
117 }
118}
119
120class CollectionAnySerializer {
121 constructor(

Callers 1

putAccessorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected