MCPcopy Index your code
hub / github.com/redis/node-redis / #decodeDouble

Method #decodeDouble

packages/client/lib/RESP/decoder.ts:336–355  ·  view source on GitHub ↗
(type, chunk)

Source from the content-addressed store, hash-verified

334 }
335
336 #decodeDouble(type, chunk) {
337 if (type === String) {
338 return this.#decodeSimpleString(String, chunk);
339 }
340
341 switch (chunk[this.#cursor]) {
342 case ASCII.n:
343 this.#cursor += 5; // skip nan\r\n
344 return NaN;
345
346 case ASCII['+']:
347 return this.#maybeDecodeDoubleInteger(false, chunk);
348
349 case ASCII['-']:
350 return this.#maybeDecodeDoubleInteger(true, chunk);
351
352 default:
353 return this.#decodeDoubleInteger(false, 0, chunk);
354 }
355 }
356
357 #maybeDecodeDoubleInteger(isNegative, chunk) {
358 return ++this.#cursor === chunk.length ?

Callers 2

#decodeTypeValueMethod · 0.95

Calls 3

#decodeSimpleStringMethod · 0.95
#decodeDoubleIntegerMethod · 0.95

Tested by

no test coverage detected