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

Method #decodeNumber

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

Source from the content-addressed store, hash-verified

234 }
235
236 #decodeNumber(type, chunk) {
237 if (type === String) {
238 return this.#decodeSimpleString(String, chunk);
239 }
240
241 switch (chunk[this.#cursor]) {
242 case ASCII['+']:
243 return this.#maybeDecodeNumberValue(false, chunk);
244
245 case ASCII['-']:
246 return this.#maybeDecodeNumberValue(true, chunk);
247
248 default:
249 return this.#decodeNumberValue(
250 false,
251 this.#decodeUnsingedNumber.bind(this, 0),
252 chunk
253 );
254 }
255 }
256
257 #maybeDecodeNumberValue(isNegative, chunk) {
258 const cb = this.#decodeUnsingedNumber.bind(this, 0);

Callers 2

#decodeTypeValueMethod · 0.95

Calls 3

#decodeSimpleStringMethod · 0.95
#decodeNumberValueMethod · 0.95

Tested by

no test coverage detected