(object, remaining, typeMapping, chunk)
| 1068 | } |
| 1069 | |
| 1070 | #decodeMapAsObject(object, remaining, typeMapping, chunk) { |
| 1071 | while (remaining > 0) { |
| 1072 | if (this.#cursor >= chunk.length) { |
| 1073 | return this.#decodeMapAsObject.bind( |
| 1074 | this, |
| 1075 | object, |
| 1076 | remaining, |
| 1077 | typeMapping |
| 1078 | ); |
| 1079 | } |
| 1080 | |
| 1081 | const key = this.#decodeMapKey(typeMapping, chunk); |
| 1082 | if (typeof key === 'function') { |
| 1083 | return this.#continueDecodeMapAsObjectKey.bind( |
| 1084 | this, |
| 1085 | object, |
| 1086 | remaining, |
| 1087 | key, |
| 1088 | typeMapping |
| 1089 | ); |
| 1090 | } |
| 1091 | |
| 1092 | if (this.#cursor >= chunk.length) { |
| 1093 | return this.#continueDecodeMapAsObjectValue.bind( |
| 1094 | this, |
| 1095 | object, |
| 1096 | remaining, |
| 1097 | key, |
| 1098 | this.#decodeNestedType.bind(this, typeMapping), |
| 1099 | typeMapping |
| 1100 | ); |
| 1101 | } |
| 1102 | |
| 1103 | const value = this.#decodeNestedType(typeMapping, chunk); |
| 1104 | if (typeof value === 'function') { |
| 1105 | return this.#continueDecodeMapAsObjectValue.bind( |
| 1106 | this, |
| 1107 | object, |
| 1108 | remaining, |
| 1109 | key, |
| 1110 | value, |
| 1111 | typeMapping |
| 1112 | ); |
| 1113 | } |
| 1114 | |
| 1115 | object[key] = value; |
| 1116 | --remaining; |
| 1117 | } |
| 1118 | |
| 1119 | return object; |
| 1120 | } |
| 1121 | |
| 1122 | #continueDecodeMapAsObjectKey(object, remaining, keyCb, typeMapping, chunk) { |
| 1123 | const key = keyCb(chunk); |
no test coverage detected