(key: string[], fn: (draft: T) => void)
| 278 | }) |
| 279 | |
| 280 | const update: Interface["update"] = <T>(key: string[], fn: (draft: T) => void) => |
| 281 | Effect.gen(function* () { |
| 282 | const value = yield* withResolved(key, (target, rw) => |
| 283 | TxReentrantLock.withWriteLock( |
| 284 | rw, |
| 285 | Effect.gen(function* () { |
| 286 | const content = yield* wrap(target, fs.readJson(target)) |
| 287 | fn(content as T) |
| 288 | yield* writeJson(target, content) |
| 289 | return content |
| 290 | }), |
| 291 | ), |
| 292 | ) |
| 293 | return value as T |
| 294 | }) |
| 295 | |
| 296 | const write: Interface["write"] = (key: string[], content: unknown) => |
| 297 | Effect.gen(function* () { |
no test coverage detected