MCPcopy
hub / github.com/redis/node-redis / #decodeSetAsSet

Method #decodeSetAsSet

packages/client/lib/RESP/decoder.ts:843–871  ·  view source on GitHub ↗
(set, remaining, typeMapping, chunk)

Source from the content-addressed store, hash-verified

841 }
842
843 #decodeSetAsSet(set, remaining, typeMapping, chunk) {
844 // using `remaining` instead of `length` & `set.size` to make it work even if the set contains duplicates
845 while (remaining > 0) {
846 if (this.#cursor >= chunk.length) {
847 return this.#decodeSetAsSet.bind(
848 this,
849 set,
850 remaining,
851 typeMapping
852 );
853 }
854
855 const item = this.#decodeNestedType(typeMapping, chunk);
856 if (typeof item === 'function') {
857 return this.#continueDecodeSetAsSet.bind(
858 this,
859 set,
860 remaining,
861 item,
862 typeMapping
863 );
864 }
865
866 set.add(item);
867 --remaining;
868 }
869
870 return set;
871 }
872
873 #continueDecodeSetAsSet(set, remaining, itemCb, typeMapping, chunk) {
874 const item = itemCb(chunk);

Callers 2

#decodeSetItemsMethod · 0.95

Calls 2

#decodeNestedTypeMethod · 0.95
addMethod · 0.65

Tested by

no test coverage detected