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

Method #readDefinite

cbor/sequence_decoder_stream.ts:167–180  ·  view source on GitHub ↗
(
    items: number | bigint,
  )

Source from the content-addressed store, hash-verified

165 }
166
167 async *#readDefinite(
168 items: number | bigint,
169 ): AsyncGenerator<CborStreamOutput> {
170 items = BigInt(items);
171 for (let i = 0n; i < items; ++i) {
172 const x = await this.#decode(
173 arrayToNumber((await this.#read(1, true)).buffer, true) as number,
174 );
175 if (x instanceof Array) {
176 yield x[0];
177 await x[1];
178 } else yield x;
179 }
180 }
181
182 async *#readIndefinite(
183 denyInnerIndefinite: boolean,

Callers 2

#decodeFourMethod · 0.95
#decodeFiveMethod · 0.95

Calls 3

#decodeMethod · 0.95
#readMethod · 0.95
arrayToNumberFunction · 0.90

Tested by

no test coverage detected