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

Function encodeObject

cbor/_common_encode.ts:214–226  ·  view source on GitHub ↗
(
  input: { [k: string]: CborType },
  output: Uint8Array,
  offset: number,
)

Source from the content-addressed store, hash-verified

212}
213
214function encodeObject(
215 input: { [k: string]: CborType },
216 output: Uint8Array,
217 offset: number,
218): number {
219 output[offset] = 0b101_00000;
220 offset = encodeHeader(0b101_00000, Object.keys(input).length, output, offset);
221 for (const key in input) {
222 offset = encodeString(key, output, offset);
223 offset = encode(input[key], output, offset);
224 }
225 return offset;
226}
227
228function encodeDate(input: Date, output: Uint8Array, offset: number): number {
229 output[offset++] = 0b110_00001;

Callers 1

encodeFunction · 0.85

Calls 4

encodeHeaderFunction · 0.85
encodeStringFunction · 0.85
keysMethod · 0.80
encodeFunction · 0.70

Tested by

no test coverage detected