MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / readInt

Function readInt

packages/migrate/scripts/jnoj.ts:23–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21 return result;
22 };
23 const readInt = () => {
24 let val = 0;
25 if (!'0123456789'.includes(serialized[0])) throw new Error(`Expected number, got "${serialized[0]}", initial "${initial}"`);
26 while ('0123456789'.includes(serialized[0])) {
27 val = val * 10 + +serialized[0];
28 serialized = serialized.slice(1);
29 }
30 return val;
31 };
32 const readToken = (token: string) => {
33 if (serialized.startsWith(token)) serialized = serialized.slice(token.length);
34 else throw new Error(`Expected token "${token}", got "${serialized.slice(0, token.length)}", initial "${initial}"`);

Callers 1

parsePhpArrayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected