(path: string)
| 133 | } |
| 134 | |
| 135 | export 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 | |
| 149 | export function sliceArrayFromIndex<T>( |
| 150 | values: readonly T[], |
no test coverage detected