(set, remaining, typeMapping, chunk)
| 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); |
no test coverage detected