Function
extractJSON
(line: string, input: any)
Source from the content-addressed store, hash-verified
| 26 | // 'static' helper methods |
| 27 | |
| 28 | export function extractJSON(line: string, input: any): string | null { |
| 29 | if (!input && !DATA_LINE_REGEX.test(line)) { |
| 30 | return null; |
| 31 | } else if (!input) { |
| 32 | line = line.substring(5); |
| 33 | } |
| 34 | try { |
| 35 | return JSON.parse(line); |
| 36 | } catch (e) { |
| 37 | return null; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | export function pathString(path: string[]): string { |
| 42 | return `/${path ? path.join("/") : ""}`; |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…