( filePath: string, )
| 81 | ) |
| 82 | |
| 83 | const readFileJson = <T extends JsonValue = JsonValue>( |
| 84 | filePath: string, |
| 85 | ): T.Effect<OT.HasTracer, ReadFileError | FileNotFoundError | JsonParseError, T> => |
| 86 | pipe( |
| 87 | readFile(filePath), |
| 88 | T.chain((str) => |
| 89 | T.tryCatch( |
| 90 | () => JSON.parse(str) as T, |
| 91 | (error) => new JsonParseError({ str, error }), |
| 92 | ), |
| 93 | ), |
| 94 | ) |
| 95 | |
| 96 | const readFileJsonIfExists = <T extends JsonValue = JsonValue>( |
| 97 | filePath: string, |
no test coverage detected
searching dependent graphs…