MCPcopy Create free account
hub / github.com/Snowflyt/tinyeffect / readSettings

Function readSettings

test/README.example.proof.ts:485–496  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

483 };
484
485 const readSettings = (path: string): Effected<Logging | ReadFile, Settings> =>
486 effected(function* () {
487 const content = yield* readFile(path);
488 try {
489 const settings = JSON.parse(content);
490 yield* logger.log("Settings loaded");
491 return settings;
492 } catch (e) {
493 yield* logger.error("Failed to parse settings file:", e);
494 return defaultSettings;
495 }
496 });
497
498 const readSettingsWithoutLogging = (path: string) =>
499 readSettings(path).resume(

Callers 1

Calls 3

effectedFunction · 0.90
parseJSONFunction · 0.70
catchMethod · 0.65

Tested by

no test coverage detected