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

Method #decodeZero

cbor/sequence_decoder_stream.ts:241–252  ·  view source on GitHub ↗
(aI: number)

Source from the content-addressed store, hash-verified

239 }
240
241 async #decodeZero(aI: number): Promise<number | bigint> {
242 if (aI < 24) return aI;
243 if (aI <= 27) {
244 return arrayToNumber(
245 (await this.#read(2 ** (aI - 24), true)).buffer,
246 true,
247 );
248 }
249 throw new RangeError(
250 `Cannot decode value (0b000_${aI.toString(2).padStart(5, "0")})`,
251 );
252 }
253
254 async #decodeOne(aI: number): Promise<number | bigint> {
255 if (aI > 27) {

Callers 3

#decodeMethod · 0.95
#decodeOneMethod · 0.95
#decodeSixMethod · 0.95

Calls 3

#readMethod · 0.95
arrayToNumberFunction · 0.90
toStringMethod · 0.45

Tested by

no test coverage detected