MCPcopy Create free account
hub / github.com/denoland/std / #readIndefinite

Method #readIndefinite

cbor/sequence_decoder_stream.ts:182–201  ·  view source on GitHub ↗
(
    denyInnerIndefinite: boolean,
    message?: string,
  )

Source from the content-addressed store, hash-verified

180 }
181
182 async *#readIndefinite(
183 denyInnerIndefinite: boolean,
184 message?: string,
185 ): AsyncGenerator<CborStreamOutput> {
186 while (true) {
187 const byte = arrayToNumber(
188 (await this.#read(1, true)).buffer,
189 true,
190 ) as number;
191 if (byte === 0b111_11111) break;
192 if (denyInnerIndefinite && (byte & 0b000_11111) === 31) {
193 throw new TypeError(message);
194 }
195 const x = await this.#decode(byte);
196 if (x instanceof Array) {
197 yield x[0];
198 await x[1];
199 } else yield x;
200 }
201 }
202
203 async *#decodeSequence(): AsyncGenerator<CborStreamOutput> {
204 while (true) {

Callers 4

#decodeTwoMethod · 0.95
#decodeThreeMethod · 0.95
#decodeFourMethod · 0.95
#decodeFiveMethod · 0.95

Calls 3

#readMethod · 0.95
#decodeMethod · 0.95
arrayToNumberFunction · 0.90

Tested by

no test coverage detected