MCPcopy Create free account
hub / github.com/Effect-TS/effect / writePackedValues

Function writePackedValues

packages/effect/src/protobuf/internal/binary.ts:1000–1016  ·  view source on GitHub ↗
(
  w: Writer,
  type: D.ScalarValueType | D.EnumValueType,
  list: ReadonlyArray<unknown>
)

Source from the content-addressed store, hash-verified

998}
999
1000const writePackedValues = (
1001 w: Writer,
1002 type: D.ScalarValueType | D.EnumValueType,
1003 list: ReadonlyArray<unknown>
1004): void => {
1005 let index = 0
1006 try {
1007 if (type.kind === "enum") {
1008 for (; index < list.length; index++) writeEnum(w, type, list[index])
1009 } else {
1010 const write = scalarWriters[type.scalar]
1011 for (; index < list.length; index++) write(w, list[index])
1012 }
1013 } catch (error) {
1014 rethrow(error, index)
1015 }
1016}
1017
1018const writeMapKey = (w: Writer, type: D.ScalarValueType, key: string): void => {
1019 w.tag(1, wireTypeOf(type) as ProtobufWriter.WireType)

Callers 1

writePackedFunction · 0.85

Calls 3

writeEnumFunction · 0.85
rethrowFunction · 0.85
writeFunction · 0.50

Tested by

no test coverage detected