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

Method #decodeMapItems

packages/client/lib/RESP/decoder.ts:910–936  ·  view source on GitHub ↗
(length, typeMapping, chunk)

Source from the content-addressed store, hash-verified

908 }
909
910 #decodeMapItems(length, typeMapping, chunk) {
911 switch (typeMapping[RESP_TYPES.MAP]) {
912 case Map:
913 return this.#decodeMapAsMap(
914 new Map(),
915 length,
916 typeMapping,
917 chunk
918 );
919
920 case Array:
921 return this.#decodeArrayItems(
922 new Array(length * 2),
923 0,
924 typeMapping,
925 chunk
926 );
927
928 default:
929 return this.#decodeMapAsObject(
930 {},
931 length,
932 typeMapping,
933 chunk
934 );
935 }
936 }
937
938 #decodeMapAsMap(map, remaining, typeMapping, chunk) {
939 // using `remaining` instead of `length` & `map.size` to make it work even if the map contains duplicate keys

Callers 2

#decodeMapMethod · 0.95

Calls 3

#decodeMapAsMapMethod · 0.95
#decodeArrayItemsMethod · 0.95
#decodeMapAsObjectMethod · 0.95

Tested by

no test coverage detected