MCPcopy Create free account
hub / github.com/Noumena-Network/code / readJsonLines

Function readJsonLines

src/testing/replContractHarness.ts:135–147  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

133}
134
135export function readJsonLines<T>(path: string): T[] {
136 if (!existsSync(path)) {
137 return []
138 }
139 const text = readFileSync(path, 'utf8').trim()
140 if (text.length === 0) {
141 return []
142 }
143 return text
144 .split('\n')
145 .filter(line => line.length > 0)
146 .map(line => JSON.parse(line) as T)
147}
148
149export function sliceArrayFromIndex<T>(
150 values: readonly T[],

Calls 2

existsSyncFunction · 0.90
readFileSyncFunction · 0.90

Tested by

no test coverage detected