MCPcopy Create free account
hub / github.com/denoland/std / encodeMap

Function encodeMap

cbor/_common_encode.ts:257–272  ·  view source on GitHub ↗
(
  input: Map<CborType, CborType>,
  output: Uint8Array,
  offset: number,
)

Source from the content-addressed store, hash-verified

255}
256
257function encodeMap(
258 input: Map<CborType, CborType>,
259 output: Uint8Array,
260 offset: number,
261): number {
262 // Tag Number 259 = [217, 1, 3]
263 output[offset++] = 217;
264 output[offset++] = 1;
265 output[offset++] = 3;
266 offset = encodeHeader(0b101_00000, input.size, output, offset);
267 for (const pair of input) {
268 offset = encode(pair[0], output, offset);
269 offset = encode(pair[1], output, offset);
270 }
271 return offset;
272}

Callers 1

encodeFunction · 0.85

Calls 2

encodeHeaderFunction · 0.85
encodeFunction · 0.70

Tested by

no test coverage detected