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

Function encodeCborSequence

cbor/encode_cbor_sequence.ts:37–46  ·  view source on GitHub ↗
(values: CborType[])

Source from the content-addressed store, hash-verified

35 * @returns A {@link Uint8Array} representing the encoded data.
36 */
37export function encodeCborSequence(values: CborType[]): Uint8Array {
38 let o = 0;
39 for (const value of values) o += calcEncodingSize(value);
40 const output = new Uint8Array(o);
41
42 o = 0;
43 for (const value of values) o = encode(value, output, o);
44 if (o !== output.length) return output.subarray(0, o);
45 return output;
46}

Calls 2

calcEncodingSizeFunction · 0.90
encodeFunction · 0.90

Tested by

no test coverage detected