MCPcopy Create free account
hub / github.com/TanStack/router / parseMaybeDataJs

Function parseMaybeDataJs

scripts/benchmarks/bundle-size/pr-report.mjs:68–78  ·  view source on GitHub ↗
(raw)

Source from the content-addressed store, hash-verified

66}
67
68function parseMaybeDataJs(raw) {
69 const trimmed = raw.trim()
70
71 if (trimmed.startsWith('window.BENCHMARK_DATA')) {
72 const sandbox = { window: {} }
73 vm.runInNewContext(trimmed, sandbox, { timeout: 1000 })
74 return sandbox.window.BENCHMARK_DATA
75 }
76
77 return JSON.parse(trimmed)
78}
79
80function readJsonMaybeData(filePath) {
81 return parseMaybeDataJs(fs.readFileSync(filePath, 'utf8'))

Callers 2

readJsonMaybeDataFunction · 0.70

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected