MCPcopy Create free account
hub / github.com/alexbudure/queuedash / parseArray

Method parseArray

packages/ui/src/utils/jsonEditor.ts:193–229  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

191 }
192
193 private parseArray(): unknown[] {
194 this.consume("[");
195 this.skipWhitespace();
196
197 const value: unknown[] = [];
198
199 if (this.peek() === "]") {
200 this.consume("]");
201 return value;
202 }
203
204 while (!this.isAtEnd()) {
205 value.push(this.parseValue());
206 this.skipWhitespace();
207
208 if (this.peek() === ",") {
209 this.consume(",");
210 this.skipWhitespace();
211
212 if (this.peek() === "]") {
213 this.consume("]");
214 return value;
215 }
216
217 continue;
218 }
219
220 if (this.peek() === "]") {
221 this.consume("]");
222 return value;
223 }
224
225 throw new JSONishSyntaxError('Expected "," or "]" in array literal.');
226 }
227
228 throw new JSONishSyntaxError("Unterminated array literal.");
229 }
230
231 private parseObjectKey(): string {
232 this.skipWhitespace();

Callers 1

parseValueMethod · 0.95

Calls 5

consumeMethod · 0.95
skipWhitespaceMethod · 0.95
peekMethod · 0.95
isAtEndMethod · 0.95
parseValueMethod · 0.95

Tested by

no test coverage detected