MCPcopy Create free account
hub / github.com/arktypeio/arktype / parseJsonText

Function parseJsonText

ark/aot/util.ts:16–24  ·  view source on GitHub ↗
(text: string, path: string)

Source from the content-addressed store, hash-verified

14 e instanceof Error && fileErrors.has(e)
15
16export const parseJsonText = (text: string, path: string): unknown => {
17 try {
18 return JSON.parse(text.charCodeAt(0) === 0xfeff ? text.slice(1) : text)
19 } catch (e) {
20 const error = new Error(`${path} isn't JSON: ${(e as Error).message}`)
21 fileErrors.add(error)
22 throw error
23 }
24}
25
26// the package.json fields @ark/aot reads
27export type PackageManifest = {

Callers 3

loadMethod · 0.90
readJsonFunction · 0.90
parsePackageManifestFunction · 0.85

Calls 2

parseMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected