MCPcopy
hub / github.com/partykit/partykit / parse

Method parse

packages/party.io/src/msgpack/lib/decode.ts:98–319  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96 }
97
98 public parse() {
99 const prefix = this._view.getUint8(this._offset++);
100 let value,
101 length = 0,
102 type = 0,
103 hi = 0,
104 lo = 0;
105
106 if (prefix < 0xc0) {
107 // positive fixint
108 if (prefix < 0x80) {
109 return prefix;
110 }
111 // fixmap
112 if (prefix < 0x90) {
113 return this._map(prefix & 0x0f);
114 }
115 // fixarray
116 if (prefix < 0xa0) {
117 return this._array(prefix & 0x0f);
118 }
119 // fixstr
120 return this._str(prefix & 0x1f);
121 }
122
123 // negative fixint
124 if (prefix > 0xdf) {
125 return (0xff - prefix + 1) * -1;
126 }
127
128 switch (prefix) {
129 // nil
130 case 0xc0:
131 return null;
132 // false
133 case 0xc2:
134 return false;
135 // true
136 case 0xc3:
137 return true;
138
139 // bin
140
141 case 0xc4:
142 length = this._view.getUint8(this._offset);
143 this._offset += 1;
144 return this._bin(length);
145 case 0xc5:
146 length = this._view.getUint16(this._offset);
147 this._offset += 2;
148 return this._bin(length);
149 case 0xc6:
150 length = this._view.getUint32(this._offset);
151 this._offset += 4;
152 return this._bin(length);
153
154 // ext
155

Callers 15

_arrayMethod · 0.95
_mapMethod · 0.95
decodeFunction · 0.95
decodeFunction · 0.80
parseBatchMarkerFunction · 0.80
doneFunction · 0.80
initFunction · 0.80
index.tsxFile · 0.80
inject-process.jsFile · 0.80
bin.tsxFile · 0.80
readUserConfigFunction · 0.80
createClerkSessionFunction · 0.80

Calls 4

_mapMethod · 0.95
_arrayMethod · 0.95
_strMethod · 0.95
_binMethod · 0.95

Tested by 1

parseSessionIDFunction · 0.64