MCPcopy Create free account
hub / github.com/Effect-TS/effect / value

Function value

packages/effect/src/internal/jsonParser.ts:229–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

227 * collection returns `undefined`; the collection is completed later.
228 */
229 const value = (): unknown => {
230 const code = text.charCodeAt(i)
231 switch (code) {
232 case 0x7b:
233 stack.push({ object: true, value: {}, key: "", first: true })
234 i++
235 return undefined
236 case 0x5b:
237 stack.push({ object: false, value: [], first: true })
238 i++
239 return undefined
240 case 0x22:
241 return string(0x22)
242 case 0x27:
243 return json5 ? string(0x27) : fail(i)
244 case 0x6e:
245 return word("null", null)
246 case 0x74:
247 return word("true", true)
248 case 0x66:
249 return word("false", false)
250 case 0x2b:
251 case 0x2d:
252 case 0x2e:
253 case 0x49:
254 case 0x4e:
255 return number()
256 }
257 return isDigit(code) ? number() : fail(i)
258 }
259
260 /** After a member: consumes a comma unless the collection ends. */
261 const separated = (close: number) => {

Callers 1

parseFunction · 0.70

Calls 6

stringFunction · 0.70
failFunction · 0.70
wordFunction · 0.70
numberFunction · 0.70
isDigitFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected